I have made a page which gets loaded in an IFrame and it needs to call a function on the parent page after it finishes loading. It works locally in development (on the same domain) but in the Real World it is hosted on a completely different domain, so obviously I am running into Cross domain problems, ie: Unsafe JavaScript attempt to access frame with URL from frame with URL Domains, protocols and ports must match. I control both the servers, so is it possible for me to put something on one or both of the servers that says they're allowed to talk to each other? I have looked at setting 'document.domain' in both the Iframe page and the parent page. I have experimented with setting the Access Control Header: header('Access-Control-Allow-Origin:.' ); But neither of those work.
![]()
Is there any way of allowing an Iframe calling a function in the Parent window on a completely different domain when I control both servers?
![]()
If a document contain frames (iframe> tags), the browser creates one window object for the HTML document, and one additional window object for each frame. Note: There is no public standard that applies to the Window object, but all major browsers support it. I ask because of the possibility of configuring the iFrame in a sub-sub. You should be able to roll your own scroll to top method by calling the. And smooth scroll up that we can get with the jQuery execution method? Kind of function that would allow us to scroll the parent window from the custom tile.
'Christian Radermacher' schreef in bericht news:[email protected]. I have document with an iframe in it. I'm able to call a javascript function in the main-document from the javascript inside the iframe-document.
I have difficulties to do the other way round, i.e. To call a function in the iframe-document from javascript in the main-document. The following works with IE, Opera 7 and Mozilla when both pages are hosted on the same domain/environment: d = document; f = d.frames? D.frames'frameName': d.getElementById('frameId'); p = f.document f.contentWindow.document; p.functionName; JW. Hi, In article, Nec wrote: When i use the functioncall window.frames.contens.alerter('dsa') (in then iFrame called contens, and the function called alerter) i get this message in the FireFox Javascript Console: Error: window.frames.contens has no properties The script wors fine in IE (or rather: a variant of it) som the frame name and fuction is right.
The parent page of the IFrame needs to contain the functions called by a page loaded into the IFrame. I hope it helps, Ranbir.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |