If you're using PHP or another server side language you could just put it in the GET or other data for the top page. I think you know how that works, you pass the page name or a token that resolves to the page name and have the src attribute of the iframe written by the server.
If no server side language is available, a javascript 'GET' can be used. The principle is the same only everything is done on the client side. If you need this, here's a simple javascript function to read a GET type query string:
Code:
function getQval(n) {
if(typeof n !== 'string'){
return null;
}
var r = new RegExp('[?&;]' + n + '=([^&;#]*)'), m = location.search;
return (m = r.exec(m))? unescape(m[1]) : null;
}
So if your link on the other page is href="index.htm?ipage=aboutus", on index.htm you could do like:
Code:
if (getQval('ipage') === 'aboutus'){
//do something here to make the src attribute of the iframe be "aboutus.htm"
}
In any case, as I think you know, the top page and the page in the iframe must be on the same domain. Your question implies that you don't know that the other page:
I was just wondering if a page can be loaded into the iframe from a link that is on
another page
That other page, as long as it isn't the top page or the page in the iframe, it doesn't have to be on the same domain.
Bookmarks