View Full Version : insert string into page's iframe
zoobie
02-14-2006, 06:31 AM
I think I did this a few years ago but lost the code when I updated to XP pro...
Anyway, how would I insert the string below into page.php's iframe from an external link?
<iframe name="myframe"></iframe>
http://mysite.com/community/album_cat.php?cat_id=4
I suppose I could post a form but isn't there a simple way to pass the URL and target the iframe?
Thanks
You may pass a parameter as a querry in the address (iframe's page location), but this is quite similar with a submit action. You may also try extended AJAX (http://ajaxextended.com/), but is not quite a secure method (at least some says so, I would not be so sure, well...)
There is no other way, if the page in the iframe belongs to another domain, you can not refere it via javascript, as cross-domain reference is impossible, for obvious security reasons.
zoobie
02-14-2006, 10:04 AM
turns out i was targeting a frame on the same page a few years ago...thought i used js, however
guess the form is the simpliest way...one page...done
thx
srinivasm2006
02-14-2006, 10:04 AM
just give the location for iframe
<iframe name="myframe" src="http://mysite.com/community/album_cat.php?cat_id=4" >
</iframe>
turns out i was targeting a frame on the same page a few years ago
If the parent and the page loaded in iframe are from same domain, the loaded page is to be found as (give your iframe element an id)
var myLoadedPage = document.getElementById('iframeid').contentWindow;
now you may target whichever element of its document as:
myLoadedPage.document.getElementById('elementid');
play with this
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.