How can you check if your document is opened in an

2020-02-28 06:40发布

问题:

Is there a way to know if your page is opened inside of an IFrame?

An idea I had was to see if the window object has a .parent property, but this apparently is also true of standalone windows which are opened by Javascript's window.open() function.

回答1:

if (window.top != window.self)
 {
}