Forum Moderators: open

Message Too Old, No Replies

iFrame linking

Linking from another site to my site that will pull up the iFrame page

         

visuale

8:31 pm on Mar 26, 2005 (gmt 0)

10+ Year Member



Here is my situation,

Let's say I am on AIM and I want to link a friend to a certain page on my website that uses iFrames. Say the page I want to link him to is the 'FAQ' page. If I give him this link 'www.mysite.com/faq.html' it will just bring up that page and not bring it up inside the iFrame on index.html

How do I do this? I hope I have explained it well enough.

Thanks!

tedster

11:05 pm on Mar 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Weclome to to forums, visuale.

Any html document that is displayed within a frame or an iframe can (and should, IMO) also contain script that inserts it into its parent page in the event that someone comes there directly -- an "orphan"display of a page that is intended to have a "parent" . Search engines index frame documents a lot and send people directly to the orphan all the time.

Thid can be done with javascript. We have an example of how to do this with a regular frame page - but you can adapt the idea for an iframe page with just a few changes:

See Message #21 on:
[webmasterworld.com...]

visuale

8:06 am on Mar 27, 2005 (gmt 0)

10+ Year Member



First off, thanks for the welcome.
Second, I took a look at that code. So by modifying the script a bit, do you think this will work?


<html>
<head>
<title>Master Frameset</title>
</head>

<script language="JavaScript" type="text/javascript">

origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)

document.write('<iframe src="home.html" name="nav"><frame src=\"' + contentURL + '\" name="content"><\/iframe>')

</script>
</html>

So i make a whole new html document solely for this purpose, is this correct?

tedster

5:33 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that is exactly the idea. Also, put the other bit of script on every potential content page and you can send people directly to the content url - it should pop right in to the (new) parent page.

visuale

8:06 pm on Mar 27, 2005 (gmt 0)

10+ Year Member



Okay thanks a lot.
I'm testing this right now. As for the linking part, will I need to make a link like this
http://www.mysite.com/?=page.html
?

Or will I just be able to direct them to the page.html?

tedster

10:10 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can just send people to what would be the orphan page - the script there generates the query string and attaches it to the url it uses to redirect to the parent page..