Home > php教程 > PHP开发 > body text

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

高洛峰
Release: 2016-12-03 14:23:14
Original
2202 people have browsed it

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);
}
Copy after login

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!