Browsers can block access to window.top due to same domain.
Example
top and self are both window objects (along with parent), so you're seeing if your window is the top window.
Example
<script>
inIframe();
function inIframe () {
try {
var isif = window.self !== window.top;
if(isif == false){
//not iframe
}else{
//in iframe
}
} catch (e) {
//not iframe
}
}
</script>
top and self are both window objects (along with parent), so you're seeing if your window is the top window.
No comments:
Post a Comment