iframed version of the site and back button problem

Z

zalun

Hi

I created a site which can be partially iframed (or framed).

I check if (self == top) and change CSS to turn off some divs.

The rest of the site which cannot be iframed does top.location =
self.location and displays content on the top.

The problem is that when user uses his back button browser stays on the
non iframed version.
It is because last page was trying to display part of the site with
top.location = self.location code.

Is there any way to avoid this behaviour?
 
R

Randy Webb

zalun said the following on 3/21/2006 10:28 AM:
Hi

I created a site which can be partially iframed (or framed).

I check if (self == top) and change CSS to turn off some divs.

The rest of the site which cannot be iframed does top.location =
self.location and displays content on the top.

The problem is that when user uses his back button browser stays on the
non iframed version.
It is because last page was trying to display part of the site with
top.location = self.location code.

Is there any way to avoid this behaviour?

top.location.replace(self.location);
 
T

Thomas 'PointedEars' Lahn

zalun said:

OMG. Remove that from your bookmarks. NOW.
One has to change location of the page using following code:

if (document.images)
top.location.replace(self.location);
else
top.location.href = self.location;

Utter nonsense. You are testing for one object, but you use another.
It should be more like

function isMethod(a)
{
if (typeof a == "string") a = eval(a);
var t;
return (a && (t = typeof a) == "function" || t == "object");
}

var wTop = window.top;
if (isMethod(wTop.location.replace))
{
wTop.location.replace(window.location);
}
else
{
wTop.location = window.location;
}

<URL:http://pointedears.de/scripts/test/whatami>
<URL:http://jibbering.com/faq/faq_notes/not_browser_detect.html>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top