javascript - How can I check whether I'm in the topmost frame? -


I have a function in JavaScript that is included in the main HTML document and all embedded iframes . Function should work in the main document. So I tried:

  function f () {if (parent === null) {... the real work is here ...} else {parent.f (); // call parent}}  

This does not work, obviously, original never null or undefined Does not happen. Currently, I use the window == guardian which works but I am uncomfortable. Is that right? Why? How is it compatible?

Maybe window == top ? Tested with iframes, but I saw that Google uses Gmail on it


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -