javascript wait on a separate thread in IE7

Last post 09-03-2008 12:38 PM by sagesmith. 11 replies.

Sort Posts:

  • javascript wait on a separate thread in IE7

    06-12-2007, 1:54 PM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    Prior to IE7 the following code was a nice way to simulate a pause without stopping the thread that was used by the browser to render elements on a page:

    function pause(nMilleseconds)

    {

    var dialogScript = 'window.setTimeout(' + ' function () { window.close(); }, ' + nMilleseconds + ');'; var result = window.showModalDialog('javascript:document.writeln(' + '"<script>' + dialogScript + '</script>")');

    }

     This was a widely known method, and has since been "fixed" in IE7 as it was identified by MSFT as a vulnerability.

    Does anyone know any tricks to mimic this in IE7?  Or, specific to my implementation, another way to allow the browser to render animated GIFs while waiting for a synchronous XMLHttp request. 

  • Re: javascript wait on a separate thread in IE7

    06-12-2007, 11:34 PM
    • All-Star
      20,664 point All-Star
    • A1ien51
    • Member since 05-06-2005, 6:46 PM
    • MD USA
    • Posts 3,798

    Why don't you change over to a Async request. You can easily throw up a layer on top if the page with an animation saying it is running.

    Eric 

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 10:46 AM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    Thank you for the response.  I guess I should have underlined the "synchronous" part.  Italics didn't block an obvious non-answer to my problem.

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 11:07 AM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    by the way, great book Eric!  It is the AJAX bible in our shop.

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 11:35 AM
    • Star
      13,726 point Star
    • JoshStodola
    • Member since 01-16-2007, 9:17 AM
    • Heartland of America
    • Posts 3,177

    I guess instead of an animated GIF you could try a Javascript-based animation.  Like a simple trailing period animation.

    I use this one and my clients love it: http://scriptasylum.com/background/xp_progress/xp_progress.html

    Hope this helps!

    Josh Stodola ← Come check out my blog!
  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 11:35 AM
    • All-Star
      20,664 point All-Star
    • A1ien51
    • Member since 05-06-2005, 6:46 PM
    • MD USA
    • Posts 3,798

    I did not miss the sync part. The sync request has some issues that are annoying. The one is the locking of the browser. I really do not think that there will be a work around since IE fixed thsi so called whole. I have tried a bunch of things in the past such as the wonderful iframe with the image pop ups and so forth. Seems to run into more issues with the solutions. Plus the sync request has issues to depending on what browser you are dealing with.

     I personally will never try to use a sync request. Even though they are in the application I just inherited at my new job. Been working to remove them. Pain in the (__!__). I also have issues in my application of a for loop locking up annimated gifs when it processes large datasets. Sucks!

    I always try to get around issues with using asyn and doing the "lightbox" type of effect where I throw up a layer on the page and set the opacity of it to 75% so the controls show through and rely on the OO JavaScript to handle the call back as if it were async. I know that this solution rather sucks so does trying to do any of the other hacks to get an annimation running.

     I wish I had a magic wand to make it work. Hopefully someone knows a hack that can get around the new IE7 fix. [Did this ever work with Mozilla/Firefox?]

    Eric 

    {Note to anyone that got here with for loops stoopping annimations - look into setTimeouts for loops instead of the normal for and while, yes it runs slower, but no lock ups}

     


     

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 12:32 PM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    I'm in a similar situation as far as inheriting some interesting architecture.  Basically, I have a bundle whose members need to wait for the response from the request prior before proceeding.  There is a notion of "bundling" in the handler "class" that is half baked that might help me convert this particular view to async, however my user base (all IE) is converting to 7 very soon. 

    I thought about showing the GIFs in an iFrame then doing hard pauses, is this what you were refering to as being buggy?

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 2:35 PM
    • Star
      13,726 point Star
    • JoshStodola
    • Member since 01-16-2007, 9:17 AM
    • Heartland of America
    • Posts 3,177

    Take a look at this post from Rick Strahl's Web Log, and read the comments too:

    http://west-wind.com/WebLog/posts/1227.aspx

    Josh Stodola ← Come check out my blog!
  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 2:51 PM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    JoshStodola - I appreciate your posts, however, unless I'm misunderstanding them, you seem to be distracted by the animated GIF in my implementation.  The core issue is pausing without using the thread that is used by the browser for a particular instance of a document.  The pause or wait should happen regardless of any rendering that might be occuring on a page.

  • Re: javascript wait on a separate thread in IE7

    06-13-2007, 2:55 PM
    • Star
      13,726 point Star
    • JoshStodola
    • Member since 01-16-2007, 9:17 AM
    • Heartland of America
    • Posts 3,177

    sagesmith:
    Does anyone know any tricks to mimic this in IE7?  Or, specific to my implementation, another way to allow the browser to render animated GIFs while waiting for a synchronous XMLHttp request. 

    I guess I concluded this was the core problem you are having...

    Josh Stodola ← Come check out my blog!
  • Re: javascript wait on a separate thread in IE7

    06-14-2007, 2:37 PM
    • Member
      2 point Member
    • CrazedBear
    • Member since 05-31-2006, 1:11 AM
    • Posts 1

    sagesmith, I feel your pain

    Just wanted to say that posts like this drive me nuts.  The problem is real and can not be solved with gif animation.  If anyone has a real solution I would like to hear about it.

     

     

  • Re: javascript wait on a separate thread in IE7

    09-03-2008, 12:38 PM
    • Member
      132 point Member
    • sagesmith
    • Member since 05-17-2005, 3:55 PM
    • Posts 58

    I found the answer, Google Chrome!  MSFT, you have ignored us web developers long enough!

Page 1 of 1 (12 items)