window中的一些属性理解self、top、parent

最近有遇到到iframe的相关内容:

top vs parent

top和parent的区别
很好理解,top代表着最顶层,最外层,parent代表着上一层。
当然了top和parent有可能指向同一层

the Parent is the parent window.
top is top

the top property is not the same as the parent property
window.top returns the topmost window in the hierarchy of windows.
window.parent returns the immediate parent of a window.

top vs self

self 就是自身window

判断是否被嵌入

if top == self
说明没有被嵌入iframe中

posted @   叶常落  阅读(12)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示