Jump to content
xisto Community
Sign in to follow this  
iGuest

Iframe External Link (Javascript)

Recommended Posts

This code will allow people who use iframes to link to there page, then load the iframe so that they can give external links to people that will link directly to the iframe page they want to see.

 

now this first part has to be in the head of your document

<script type='text/javascript'>window.onload = function setIframe() {	var url = window.location.href;	var i = url.indexOf("?i=");	if( i>-1 ) {  url = url.substr(i+3);  document.getElementById("body").src = url;	}	}

now this is about how your iframe tag should look

<iframe src="home.html" WIDTH=505 HEIGHT=420 name="content" id="body"></iframe>
of course replace the src/height/width/name with whatever you have in yours, the important part is "id=body"

 

here is the way you should make your links

http://www.yourdomain.com/?i=pagetoload.html

to see this code in action, click this link

 

http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.