Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detect child page in iframe

Status
Not open for further replies.

peterpann

Programmer
Jun 19, 2007
63
GB
I'm using <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "I have a child page in an iframe. How can I detect if the child page is being viewed in the parent iframe, or if the child page is being viewed alone ?
if ( (window.document.location + "") != (window.top.location + "") ) works in IE8 but stalls Chrome.
 
Code:
If (window.self == window.top){
  // not a frame 
} else { 
  // frame. 
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top