gookymedia Posted November 30, 2010 Share Posted November 30, 2010 Hi Why does this code not work in Opera? The src never seems to be set, works fine in Firefox etc: <iframe id="hidden_iframe" name="hidden_iframe" src=""></iframe> <script type="text/javascript"> document.getElementById ('hidden_iframe').src = 'http://www.jointsocial.com/cometwire.php'; </script> Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/ Share on other sites More sharing options...
ManiacDan Posted November 30, 2010 Share Posted November 30, 2010 Per the first page of google results, the proper way to change the URL of an iframe is by using iframeObj.contentWindow.location; NOT .src. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/#findComment-1141349 Share on other sites More sharing options...
gookymedia Posted November 30, 2010 Author Share Posted November 30, 2010 Dan, So are you saying: document.getElementById ('hidden_iframe').iframeObj.contentWindow.location = 'URL'; I have never actually seen that before though I rarely use iFrames! Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/#findComment-1141363 Share on other sites More sharing options...
ManiacDan Posted November 30, 2010 Share Posted November 30, 2010 That's what the search results said, give it a try. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/#findComment-1141373 Share on other sites More sharing options...
gookymedia Posted November 30, 2010 Author Share Posted November 30, 2010 Nope works in FF but still not Opera. Its like it doesnt even load anything into the iframe. Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/#findComment-1141380 Share on other sites More sharing options...
Wildbug Posted November 30, 2010 Share Posted November 30, 2010 I'm using Opera 10.63 under Linux, and I've just run a few tests using IFRAME. First of all, according to (the book) Dynamic HTML setting .src is a legitimate way to load a page into an IFRAME, and I can confirm it works under FF and Opera. Supposedly it's level-1 DOM and works all the way back to IE4. Secondly, how are you confirming that nothing is loading into the IFRAME? Via code or visually? If the URL of the document and the IFRAME don't share the same domain, you're not going to be able to access the IFRAME properties because of Same Origin Policy. Quote Link to comment https://forums.phpfreaks.com/topic/220237-iframe-source-with-javascript-opera/#findComment-1141414 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.