Opener.Location.Reload (); permission denial error is displayed in java script

I had two domains for ex. domain1 and domain2, I open the domain2 / index.aspx page as a popup from the domain1 / default.aspx website. When closing the domain2 page, I need to reload the domain1 page, I gave the javascript code as "Openener.Location.Reload ();". I get an error Allow javascript failure . Any ideas on this issue.

+4
source share
3 answers

I found that setting the parentUrl variable in a popup (obtained from the query string) and then using:

window.opener.location.href = parentUrl; 

work.

I donโ€™t know why, I think this is magic, but it works (tested on IE, chrome and Firefox). You cannot read the value of window.opener.location.href, but you can set it to whatever url you want. I use this oddity to update.

Hope this helps

+6
source

Certain properties and actions are blocked in cross-domain scenarios. What you could do is create a parent function that executes the code you need, and then call that function from a child.

Example:

 // On the parent... function DoTheRefresh() { location.reload(); } 

Then on the child:

 opener.DoTheRefresh(); 

I have done this in the past, so I donโ€™t know for sure if this is still an option. I hope this works for you :)

+2
source

You can accomplish this by putting the code in the parent window to determine when the child window has closed.

 var win2; function openWindow() { win2 = window.open('http://...','childwindow',...); checkChild(); } function checkChild() { if (win2.closed) { window.location.reload(true); } else setTimeout("checkChild()",1); } 
+2
source

All Articles