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:

3 responses to “AS3 clickTag & IE popup blocker”

  1. Sean

    You are a genius, my friend! Awesome! This works perfectly.

  2. Alex

    You’ll want to update this code for the IE11 update as the userAgent is now “Triton”.

  3. DonZottel


    import flash.external.ExternalInterface;

    var clickUrl:String = new String(root.loaderInfo.parameters.clickTag);
    var clickTarget:String = new String(root.loaderInfo.parameters.clicktarget);
    var clickUrlRequest:URLRequest = new URLRequest(clickUrl);

    function handleClick(event:MouseEvent):void {
    if (ExternalInterface.available) {
    var isIe:Boolean =“function () { return /Trident/.test(navigator.userAgent) }”);
    if (isIe) {“”, clickUrl, clickTarget);
    } else {
    navigateToURL(clickUrlRequest, clickTarget);
    } else {
    navigateToURL(clickUrlRequest, clickTarget);

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.