View Full Version : bookmarks, framed site

08-20-2004, 12:03 AM
Hi. I was wondering if someone here could help.

I'm working with a simple framed web site, www.stargazing.net/mas/index.htm. A left side called frame.htm, and the right side called home.htm. In head section of home.htm I have the following JavaScript line:

if (document.location.hash != "#noframes" && typeof(top.locsrch) != "string") document.location = "index.htm"

... If anyone calls an individual web page (example: www.stargazing.net/mas/photos2.htm) all they have to do is click [return to home], which runs home.htm. With this line of code, home.htm will then return you to the framed site.

Just one problem. Suppose I want to get to a bookmark in home.htm, as in http://www.stargazing.net/mas/home.htm#observatory home.htm ignores it and launches me back to the framed site. Question. Is there a way to get passed this barrier and to the bookmark?

08-20-2004, 12:26 AM
I don't think so. That's the main argument against frames is that they have a state, but there's no way to save the state (like a bookmark..). Even iFrames don't work here..

Most people are trying to use some sort of templating system so that there's a menu someplace that's always the same (which is usually the reason for having frames in the first place).

Here are some articles I came across:

Hope that helps,

08-20-2004, 05:33 AM
In home.htm, I suppose I could do:

if (document.location.hash != "#noframes" && typeof(top.locsrch) != "string") document.location = "index.htm" + document.location.hash

..but now index.htm has to feed the bookmark to home.htm in the right frame. Could it?

08-20-2004, 03:37 PM

08-20-2004, 09:57 PM
What I did was to 'var tophash = location.hash' in my index.htm, then in home.htm do a:

if (typeof(top.tophash) == "string" && top.tophash != "") {var h = top.tophash ; top.tophash = "" ; self.location = self.location + h}

...seems to work. Thanks for the help...Dennis

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum