How to check if page opened in iframe
To check if page opened in iframe you can compare window.self
and window.top
Check the function below.
Source Code:
<script>
function is_in_iframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
</script>
Free - Download it right now!
Tested
Include all files
Demo DownloadUnlock Your Free Download for Just $2
Get updates!
Follow @themgtechnologyCompatible Browsers
Chrome, Firefox, Safari, Opera, IE9+, Edge
Technologies Used
HTML 5, JS, jQuery