Forum Moderators: open

Message Too Old, No Replies

Detect if page is in frames.

Cross-Browser Support

         

dbeNitO

11:38 pm on Apr 12, 2004 (gmt 0)



Hello all!

I have been looking for a javascript that detects if the page is in any kind of frames and if so, navigates to a perticular page. I have found some scripts that work as needed in Internet Explorer, but do nothing in my browser of choice, opera.

Thank you for reading.

Rambo Tribble

2:09 am on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The parent object is equal to the window object if the document with the JavaScript is not within a frame, they are not equal if the page asking is within a frame, so

if (parent!= window) window.location = your_desired_location;

should put you where you want to go.