Web Analytics Made Easy -
StatCounter Loosing control of an IE window when a download starts. - CodingForum

Announcement

Collapse
No announcement yet.

Loosing control of an IE window when a download starts.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loosing control of an IE window when a download starts.

    Okay, so I have a little HTML page with a SWF playing in it. From time to time, I issue javascript commands to the HTML doc from the SWF to do some simple things like change background color:
    Code:
    getURL("javascript:document.body.style.backgroundColor='#ffffff'; void(0);");
    Seems to work fine and dandy in most browsers, including IE.

    HOWEVER, when I get further along, I present the option to download a file
    Code:
    getURL("http://www.mydomain.com/myfile.zip");
    IF the user opts to do it, IE refuses to accept anymore javascript:document commands. (Other browsers are fine.)
    IF the user doesn't do the download, then any further commands are just fine.

    Best I can figure is that when the download window opens, it somehow changes IE's focus, and any javascript commands aren't being sent to the right window.

    So, my simple-minded solution is to give my window a name
    Code:
    <script language="javascript" type="text/javascript"> window.name="myWindow"; </script>
    Then I change my request in the SWF to call that window specifically
    Code:
     getURL("javascript:myWindow.body.style.backgroundColor='#ffffff'; void(0);");
    but I'm still getting no love from IE.

    Anyone run into this?
    Is there a better approach?
    Other suggestions?

    [I don't know if this is a javascript solution or if there is a flash solution, so I'll cross-post a modified version for flash]
Working...
X