locked
Load gif image until the file got downloaded. RRS feed

  • Question

  • User-2144897193 posted

    Hi,

    Could <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937700531581067261">any one</gwmw> help me to achieve the loading <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937700533717509285">gif</gwmw> image until file got downloaded using javascript.

    <<gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937704991117975694">img</gwmw> id="<gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937704998300442125">myImage</gwmw>" <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937704993625740502">src</gwmw>="loader.gif">

    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712937707795132223661">Javascriptcode</gwmw>:

    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938045711198610967">var</gwmw> <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938045716340456940">myDiv</gwmw> = document<gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938045711238754555">.</gwmw><gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938045716689763174">getElementById</gwmw><gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938045713009824724">(</gwmw>"myDiv");

    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938195682188764611">show</gwmw> = function () {
    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938200338526080856">myDiv</gwmw><gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938200337281668190">.</gwmw>style<gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938200332686330251">.</gwmw>display = "block";
    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938205173137828395">setTimeout</gwmw><gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938205177284730782">(</gwmw>hide, 10000); // 10 seconds
    }
    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938211603915427012">hide</gwmw> = function () {
    <gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938216379391710850">myDiv</gwmw><gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938216378370744897">.</gwmw>style<gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938216372516996144">.</gwmw>display = "none";
    };

    1. I need the loader image should <gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938168527531969130">visible</gwmw> until the file downloaded completely. No matter how long does it take<gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938168532454246445"> ,</gwmw>but loader should appear until download complete<gwmw class="ginger-module-highlighter-mistake-type-3" id="gwmw-15712938168535441866544">.</gwmw></<gwmw class="ginger-module-highlighter-mistake-type-1" id="gwmw-15712938168537939612264">div</gwmw>>

    Thursday, October 17, 2019 6:28 AM

All replies

  • User-719153870 posted

    Hi kaarthikeyan,

    I believe what you are looking for is something like ASP.NET Export Excel - Show/Hide Loading Image.

    In this document, the whole point is using the cookie to check if the file has been downloaded.

    Create the cookie when you start to download in c#.

    Check if the cookie is existed and if is, show the GIF.

    After you download the file, delete the cookie.

    Hope this could help.

    Best Regard,

    Yang Shen

    Thursday, October 17, 2019 8:33 AM