Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > iframed version of the site and back button problem

Reply
Thread Tools

iframed version of the site and back button problem

 
 
zalun
Guest
Posts: n/a
 
      03-21-2006
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?

 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      03-21-2006
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);

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
 
zalun
Guest
Posts: n/a
 
      03-21-2006
After some googling I found a page
http://www.irt.org/articles/js126/index.htm#5

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;

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      03-22-2006
zalun wrote:

> After some googling I found a page
> http://www.irt.org/articles/js126/index.htm#5


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Where to get stand alone Dot Net Framework version 1.1, version2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? MowGreen [MVP] ASP .Net 5 02-09-2008 01:55 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? PA Bear [MS MVP] ASP .Net 0 02-05-2008 03:28 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? V Green ASP .Net 0 02-05-2008 02:45 AM
can u read selected text in an iframed google page?!?!?! jojoba@gmail.com Javascript 5 06-27-2007 08:52 AM
Easy way for user to allow cookies from my IFRAMED web page? Robert Oschler Javascript 0 09-06-2005 09:10 PM



Advertisments