Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A script to detect frameset - and open correct doc...

Status
Not open for further replies.

Tels

IS-IT--Management
Jul 10, 2001
290
GB
I have a site where the default page has an IFRAME, into which all other pages are loaded.

As a result, whenever you link directly to one of these other pages (ie from a search engine), you don't see the functional part of the site - the surrounding frameset.

I would like to build a javascript function to detect whether or not the current page is within the correctly named frameset.

If not, I would like it to open the frameset page and change the IFRAME's src to its own URL, before closing itself (maybe theres a more elegant way to do this)

Anyone have any Ideas or useful links - I don't even know where to start - I'm learning JavaScript and I'm not too familiar with the DOM.

ps this only has to work in IE4+ NS6 as I have an alternate sites for other users

I thank you all in advance.. :)
Tels Mixed Linux/Win2000 Network Administrator
 
so, say someone is viewing google.com but not through your frameset - you want to automatically switch to the frameset with the iframe displaying google.com?

=========================================================
if (!succeed) try();
-jeff
 
Well, I've actuall got this sorted now.

Basically I added code to the frameset page and all the subframe pages.

The subframe pages don't detect a parent they open the frameset page, passing their own url as a parameter.

When the frameset opens, it looks for this parameter and if it finds it, it alters the IFRAME src to that variable.

This is how I have succeeded. :) do you want to see the code?

Thanks for your help.... I really appreciate you took the time...

Tels
Mixed Linux/Win2000 Network Administrator
 
tels,

sounds good...glad you worked it out!
=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top