{"id":37,"date":"2008-03-03T08:16:15","date_gmt":"2008-03-03T16:16:15","guid":{"rendered":"http:\/\/www.blogs.abeazam.com\/dev\/?p=37"},"modified":"2008-03-03T08:16:15","modified_gmt":"2008-03-03T16:16:15","slug":"navigatetourl-and-popup-blockers","status":"publish","type":"post","link":"http:\/\/www.blogs.abeazam.com\/dev\/2008\/03\/navigatetourl-and-popup-blockers\/","title":{"rendered":"navigateToURL and popup blockers"},"content":{"rendered":"<p>AS3 has brought a lot of new functionality and complexity to flash development. It has also brought some new problems.<\/p>\n<p class=\"MsoNormal\">Pop up blocking is simple principle where only user initiated events can open a new window. In the case of AS2 when creating a link it had to be triggered from an onRelease\/Click event. Other wise in AS2 \u201cgetURL\u201d was adequate in any browser. <span> <\/span>Unfortunately \u201cnavigateToURL\u201d in AS3 does not seem to be useful across all browsers as even on Click it can still be pop up blocked.<o:p> <\/o:p><\/p>\n<p class=\"MsoNormal\">In my mission to get a flash only solution for opening URLs that don\u2019t get pop up blocked, I found ExternalInterface call to &#8220;window.open&#8221; works as long as its available in the browser. The basics of the code I used is below.<\/p>\n<pre lang=\"actionscript\">\n        \/\/set the desired URL here\n        var url_str:String = \"http:\/\/www.yoururl.com\"\n\n        \/\/checks to see if the browser has JS on and \n        \/\/if ExternalInterface is compatible with the browser\n\tif (ExternalInterface.available)\n\t{\n                \/\/calls the JS function \"window.open\" in a new window\n\t\tExternalInterface.call( \"window.open\", url_str, \"_blank\" );\n\t}\n\telse\n\t{\n                \/\/the fall back call is \"navigateToURL\"\n                var urlRequest:URLRequest = new URLRequest(url_str);\n\t\tnavigateToURL(urlRequest,\"_blank\");\n\t}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>AS3 has brought a lot of new functionality and complexity to flash development. It has also brought some new problems. Pop up blocking is simple principle where only user initiated events can open a new window. In the case of AS2 when creating a link it had to be triggered from an onRelease\/Click event. Other [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,9,16],"tags":[],"_links":{"self":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/37"}],"collection":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}