Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.top === window false condition in IE8

For some reason, using the

window.top === window

condition in IE8 always evaluates to false (in other browsers it works fine). What is the reason for this, and is there any other way for this condition to work cross-browser?

Thanks,

Joel

like image 865
Joel Avatar asked Feb 13 '11 12:02

Joel


1 Answers

It's a very complicated topic, but the short version is, use == when comparing windows, not ===, because of the "internal" vs. "external" reference aspect of it. You'll find that (for instance) window === self is false on some browsers.

like image 77
T.J. Crowder Avatar answered Nov 03 '22 16:11

T.J. Crowder