I am trying to redirect the page if my website opened in Iframe with the following javascript code. But it is not working in Safari and Opera browsers.
var siteurl = '<?php echo $base_url;?>'; // My website url
var currentUrl = document.referrer; // The url where my website was opened in iframe
// Check if current url is not equal the original site url
if(siteurl !== currentUrl){
// Then Redirect browser to original(siteurl)
window.top.location.href = '<?php echo $base_url;?>';
}
From Safari:
From Opera:
How can I fix this redirect problem. If there is a way, can you answer me please.
How to break out the iframe with javascript.
from Redirect URL issue in Safari and Opera with jquery
No comments:
Post a Comment