What is the difference between window, window.top and window.parent?

I just noticed that the variables top , window and parent give me the same value. I tested this on the gmail inbox. Does anyone know what is the difference between these three values?

+46
javascript html
Aug 13 2018-10-10T00:
source share
1 answer

If you are in a frame:

  • window refers to the current frame.
  • parent refers to the parent of the current frame.
  • top refers to the most remote frame.

If you are not in any frame, all this will be just a link to the current window . If you are at only one frame level, parent and top will both be references to the same thing.

+100
Aug 13 2018-10-10T00:
source share



All Articles