Flash9 Popup-blocker developments.

By hp.

For an introduction on the issue, check the old post Flash 9 for banner-ads (in norwegian).

Download the source files.

Most recent browsers support both navigateToURL and ExternalInterface. However, successful calls to the js-function do not return “YES” nor “NO” but null, causing the navigateToURL method to be called as well.

function openWindowAutoHandler(event:Event):void {
  if (externalInterfaceAvailable) {
    var openEIresult:String = ExternalInterface.call('function() {return (window.open("' + (clickTAG) + '", "_blank", "") ? "YES" : "NO") }');	
  }      
  if ((!externalInterfaceAvailable) || (openEIresult != "YES") || (userAgentString.indexOf("Opera") != -1)) {
    navigateToURL(new URLRequest(clickTAG), "_blank");		
  }
}

openEIresult in Internet Explorer 7.0: null (Loads the URL twice)
openEIresult in Internet Explorer 8.0: null (Loads the URL twice)
openEIresult in Firefox 3.5.6: “YES” (Works as intended)
openEIresult in Opera 10.10: “YES” (Loads the URL twice, caused by third test)

Anyone think of a clever fix to the dual dual loads issue, while still retaining compatibility with older browsers?

Leave a Reply