Permission denied to access resource 'href'

I am trying to reload a parent webpage from an iframe. Here is my code:

<script> $(document).ready(function() { window.parent.location.href = window.parent.location.href; }); </script> 

But it does not work. Firebug says: Permission denied to access the 'href' property

I am in the same domain, so what's the problem? I am trying to do this in a Wordpress theme.

+7
source share
2 answers

Your code will only work if the parent and child objects work from the same protocol (http / https), the same host, and the same port. This is called the Same Outcome (SOP) policy. You can check the link below: http://en.wikipedia.org/wiki/Same_origin_policy

+7
source

You can set document.domain="domainName:port" in Firefox. It cannot set the default value for the port, you must set it yourself if the port is different!

0
source

All Articles