AS3 clickTag & IE popup blocker

Recently, we at Gynzy had to implement clickTag scripts in Actionscript 3 banners. As you might know, AS 3 banners don’t work well in Internet Explorer. You’ll get a pop-up blocked warning when using navigateToURL().

After some googling I found a clickTag script at
It uses'', url, '_blank'); when the user agent of the banner is MSIE. This script worked almost perfect, it only had two requirements:
1) AllowScriptAccess needs to be true either by setting it to “always” or by setting it to “sameDomain” and loading the flash from the same domain as the hosting page.
2) The .swf file has to be embedded in html.

If the requirements are not met, actionscript will throw an error without opening the requested url (only in Internet Explorer of course). I tried to work around this problem by catching the error and use navigateToURL in case fails. See my script below:

function handleClick(mouseEvent:MouseEvent):void {
var interactiveObject:InteractiveObject = as InteractiveObject;
  var li:LoaderInfo = LoaderInfo(interactiveObject.root.loaderInfo);
  var url:String = li.parameters.clickTag;
  if (url) {
    if (ExternalInterface.available) {
      try {
        var userAgent:String ='function(){ return navigator.userAgent; }');
        if (userAgent && userAgent.indexOf("MSIE") >= 0) {
'', url, '_blank');
      } catch (e:Error) {
    navigateToURL(new URLRequest(url), '_blank');
myButton_btn.addEventListener(MouseEvent.CLICK, handleClick);

To test my script in Internet Explorer, open: as3_clicktag.html
(ideal situation, script will use

The same banner with allowscriptaccess set to never: as3_clicktag_no_scriptaccess.html
(script will use navigateToURL instead of

And the swf file without html: as3_clicktag_fixed_url.swf

In case you’re interested in the source files:

Leave a Reply

Your email address will not be published. Required fields are marked *