Search code examples
phpjavascriptinternet-explorerinternet-explorer-9access-denied

parent.location.reload in iframe not working IE


I need refresh in parent site / refresh my browser when I click testing. I have source index.php:

<iframe id="test" src="/careertest/q.php"></iframe>

and in q.php:

<a href="#" onclick="parent.location.reload(true);">testing</a>

Its working in FF LAtest version + Chrome but not working in IE 9.

He said "script70 :Permission denied."

I am already change

parent.location.reload(true)

with:

window.parent.location =window.parent.location.href;

or

document.domain=document.location.href;

but still not working...


Solution

  • use this function

    function reloadParentPage() {
        var selfUrl = unescape(parent.window.location.pathname);
        parent.location.reload(true);
    
        parent.window.location.replace(selfUrl);
    
        parent.window.location.href = selfUrl;
    }