'How can I redirect from inside an iFrame?
I use website redirect page window.location.href
, its working fine on all traffic also on iframe
traffic.
<script type="text/javascript">
window.location.href="http://newUrlLocation.com";
</script>
But when I use top.location.href
it does not redirect from inside an iframe
.
<script type="text/javascript">
top.location.href="http://newUrlLocation.com";
</script>
Any one help me please, I want to use top.location.href
for all my traffic also for iframe
Solution 1:[1]
Use: window.top.location.href
instead of: top.location.href
Difference between the two: window.top.location vs window.location
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |