Fatih Donmez
Fatih Donmez

Reputation: 4347

Javascript call from swf in iframe

I have a javascript function is called from AS3 when all are in same html document, it's all succesfull. But when i put the swf in iframe, I get an error like ;

Unsafe JavaScript attempt to access frame with URL http://example.com/ from     frame with URL http://example2.com. Domains, protocols and ports must match.

Iframe and parent documents have diffent domains. How can I fix it? In this case one of requirements is it should work with also in iframe. So putting all of them in same frame is not solution.

Upvotes: 0

Views: 613

Answers (1)

Jude Fisher
Jude Fisher

Reputation: 11294

As Philipp has commented, this is being blocked by the browser's cross-scripting protection (the SWF element in this is merely a distraction - any javascript in the child iFrame will be blocked from calling the parent frame, if they do not share the same domain).

Your parent frame should have access to the child iframe, however, so you could set a parameter in the child iframe from your swf and poll for that from the parent frame.

Otherwise it's trivial to create a server-side script in PHP or .NET or whatever you're comfortable with, and bounce a value off that.

Upvotes: 1

Related Questions