2 Replies Latest reply on Oct 26, 2006 4:46 PM by pcolby78

    navigateToURL bug in FireFox?

      Hi all,

      I'm expreiencing a strange bug with FireFox... I have the following example application:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      import flash.net.navigateToURL;
      private function onClick():void {
      navigateToURL(new URLRequest("abc.html"));
      <mx:Button label="test" click="onClick()"/>

      So, basically, when I click the "test" button, the browser should go to "abc.html".

      Now, if I run the application locally, it works perfectly as expected in both IE and FF. But, if I run the application off my webserver (Apache2), then IE still works perfectly, but FF doesn't. The behaviour I get in FF is as follows: when I click on the button, roughly half of the time it will work as expected (ie opens "abc.html" in a new tab), and the other half of the time FF displays a "FireFox prevented this site from opening a popup window" message.

      Now the fact that this only occurs when the application is served remotely is obviously due to FF's security model. But the weird part (bug?) is that the "blocking" occurs randomly. If I just click the "test" button a dozen times (slow or fast) the result will be around half a dozen new windows, with the other half a dozen blocked :(

      So, has anyone experienced this problem before? Can you spot anything wrong with the code in my example above? I've tried the example on another PC, and it has exactly the same problem - both PC's are running FireFox 1.5.

      Any thoughts would be really appreciated.

        • 1. Re: navigateToURL bug in FireFox?
          leotemp Level 1
          Yeah, FF doesnt like the "new" window, ive found its able to block all of mine however, just one of those things we can thank spamming online advertisers for. You cant blame them really, a couple days back i was reading a game site and a freakin robot melted a hole in the website crawled out and began to stomp on the text i was going to read, of course fox didnt block that ad but it gets every one i try to send to the "new" window. Maybe you can put the document you want to display in an ifram layered over your app and then toggle this visibilty or something..
          • 2. Re: navigateToURL bug in FireFox?
            pcolby78 Level 1
            Hi leotemp, thanks for you reply. I've had a play with the IFrame approach in the past, and it introduces some other problems for the type of app I'm writing (can't really say what that app is yet).

            I've done some more playing with the problem, and how's this for wierd mis-behaviour? ... I wrote an openNewWindow() JavaScript function and placed it into the HTML wrapper that loads the swf file. Then, if I call that function using navigateToURL, the same problem occurs. But if I call that function using ExternalInterface.call("openNewWindow","abc.html") then it *almost* works... you see, the ExternalInterface version works well if the call is made from a click handler (like the example above), but unfortunately, I need it to work in the result handler of a SOAP service call... and there, it is blocked again! Though this time the blocking is a lot more consistant... ie it blocks about 9 out of 10 tries :(

            I'm assuming that the problem is due to FF trying to differentiate between popups that are the direct result of user clicks, versus popups that result from automatic scripts - blocking the latter, but not the former.

            Any other ideas?!