Home  >  Article  >  php教程  >  Example of html judging whether the current page is in an iframe

Example of html judging whether the current page is in an iframe

高洛峰
高洛峰Original
2016-12-03 14:23:142243browse

When making HTML pages, we often encounter "If the current page is displayed in an iframe, we will handle it accordingly"

The judgment method is:

//判断是否在iframe中
if(self!=top){
    parent.window.location.replace(window.location.href);
}

The above html determines whether the current page is in an iframe The examples in are all the content shared by the editor


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn