Hi all, I've some sponsored URLs in my page shown inside an <iframe>. When the user clicks on one of those URLs I track the click at the server side and my server returns an alternate URL(sponsor url) with 302 status code. But the page gets loaded inside the <iframe> instead of replacing the whole page. In order to avoid I tried to return another page (with return code 200)and execute the following javascript on 'onload'
<code>
function redirect(){
redirect_url = document.getElementById('url_id').innerHTML;
window.location = redirect_url;
top.location.target="_top"
if(window.location.target!= "_top")
top.location.href=window.location.href;
}
</code>
It works but there are two issues with this implementation. 1. the User always sees this intermediate page 2. Back button does not work (need to click twice fast to come back to original page). So what's the best way to redirect to another domain from an iframe?
Thanks a lot in advance.
/SD