KiranTheWizard
KiranTheWizard

Reputation: 47

Call a javascript function from one frame's page to another frame's page, gives "Permission Denied" error

I have an page which contains frameset of 2 frames. I am loading http://testhost/test.aspx in frame1 and http://otherhost/test2.aspx in frame2. Now, i want to call the javascript function of test.aspx from test2.aspx using parent and child elements. But I am getting "Permission Denied" error, as both pages are from different domain.

Please note that test.aspx and test2.aspx are under two different hosts.

Please help me by suggesting a work around for this.

Thanks in advance.

Upvotes: 0

Views: 552

Answers (2)

Lee Kowalkowski
Lee Kowalkowski

Reputation: 11751

You can't directly call them, communication is possible if you have control over both test.aspx and test2.aspx. You can use postMessage from HTML5 in supoprted browsers.

It would be much easier to use a library that does this with fallbacks for browsers that don't support postMessage, like easyXDM.

Upvotes: 1

ctrl-alt-dileep
ctrl-alt-dileep

Reputation: 2056

You're experiencing "same origin policy" issues because pages are on two different domains.

Best "solution" yet.

https://developer.mozilla.org/en/document.domain

Upvotes: 0

Related Questions