471,122 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

breaking out of frameset problem

Hi,

I use the following code to force the page to load into the intended
frameset (navigation purposes) if visitors come to pages in a certain
section of the site from search engines/external links.

<script language="JavaScript"><!--
if (parent.location.href == self.location.href)
window.location.href = 'index.htm?pageone';
//--></script>

This works very well BUT.... if the visitor hits the browser back button all
it does is reload the page and frameset unless you either use the onsite
navigation or call up the previous pages with the carat by the back button.

Is there any way of making sure that if the visitor simply hits the back
button they break out of the frameset and return to wherever they cam from?

Thanks
Jul 20 '05 #1
1 3618
"David" <da*************@ntlworld.com> writes:
Hi,

I use the following code to force the page to load into the intended
frameset (navigation purposes) if visitors come to pages in a certain
section of the site from search engines/external links.

<script language="JavaScript"><!--
if (parent.location.href == self.location.href)
window.location.href = 'index.htm?pageone';
//--></script>

This works very well BUT.... if the visitor hits the browser back button all
it does is reload the page and frameset unless you either use the onsite
navigation or call up the previous pages with the carat by the back button.

Is there any way of making sure that if the visitor simply hits the back
button they break out of the frameset and return to wherever they cam from?

Try
if (top == self) {
location.replace('index.htm?pageone');
}

Using location.replace means that the current page is replaced, even
in the history, with the new one.

Consider whether it is a good idea to force how people see your page,
and that your frameset depends on javascript. Perhaps you should have
a different frameset for this that depends on javascript, and a
non-javascript one for people who enter at the front page.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Hans | last post: by
5 posts views Thread by dan (dj74) | last post: by
6 posts views Thread by Stefan Mueller | last post: by
2 posts views Thread by Mark | last post: by
12 posts views Thread by Geoff Cox | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.