文章

判断页面有没有被嵌套在iframe中

判断页面有没有被嵌套在iframe中

判断页面有没有被嵌套在iframe中

window.self === window.top //页面并没有被嵌套在iframe中
window.self !== window.top //页面被嵌套在iframe中

本文由作者按照 CC BY 4.0 进行授权