views:

405

answers:

2

hi,

I'm using this code to open a popup

ExternalInterface.call("function () { window.open('" + url + "','" + title + "','" + options + "'); }");

for JavaScript people: calling ExternalInterface.call(string); from flash player lets the browser do eval(string)();

as this call is within a click handler, it even works perfectly with Firefox and IE, for Opera it lets you open the popup manually. But in Safari, it is always blocked silently. Anyone have an idea how circumvent this?

thanks

back2dos

+2  A: 

I've run into this, and as far as I could tell there was no real solution... the only workaround I could find was essentially checking if window.open works, and if it doesn't use navigateToURL instead... I just found this link that explains this much better: http://www.asserttrue.com/articles/2007/08/22/workaround-for-safari-blocking-flash-initiated-pop-ups

Cay
from the link, this looks quite useful:http://www.asserttrue.com/articles/2009/04/29/navigatetowindow-project-added-to-github
Cay
thanks for the link. it does quite much what I am doing, but it's nicely wrapped ... :)
back2dos
ok, nothing seems to really work ... but this solution at least has a nice fallback integrated, so i guess, this is the best answer i could get ... :)
back2dos
+1  A: 

You shouldn't be creating your function inside of AS3. That's probably one of the reasons you are getting bad behavior.

You should create your function in the HTML or JS files and call it with EI, and pass the arguments you need.

Jasconius
do you think, that solves the problem? the javascript is definitely executed. i'll give it a try, but i'm very sceptical
back2dos
Even if it doesn't solve the problem, it's a good habit.But yes, I think that it is plausible that is the issue.
Jasconius