By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

detecting whether frame is top one and in case it isn't redrawingit as top

P: n/a
I tried soemthing like:

if (top != self) top.location.href = self;

or

if (window == top) top.location.replace("index.html");

doesn't work.

tia.
Nov 29 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Don't try to be funny. I tried many versions including string in 1st example, in second obvoiusly should be "!=" (which still doesn't work).
I would appreciate some serious reply.

Lee wrote:
/dev/nu**@localhost.ld said:
I tried soemthing like:

if (top != self) top.location.href = self;

So if this window is not the top, set the value of top.location.href (a string)
equal to self (a Window object).

or

if (window == top) top.location.replace("index.html");

if this window IS the top, replace its location with "index.html".

Keep us posted on what else you think of.

Nov 29 '05 #2

P: n/a
/dev/nu**@localhost.ld wrote:
I tried soemthing like:

if (top != self) top.location.href = self;
or

if (window == top) top.location.replace("index.html");

doesn't work.

tia.


Ok, I've got this working:

if(window.top!=window.self) window.top.location=window.self.location;
Nov 29 '05 #3

P: n/a
/dev/nu**@localhost.ld wrote:
if (window.top!=window.self) window.top.location=window.self.location;


window.self == window
PointedEars
Nov 29 '05 #4

P: n/a
Thomas 'PointedEars' Lahn wrote:
window.self == window

ok, good to know ;)
Nov 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.