html - How to disconnect JavaScript popup from opener -
i'm opening popup main page code this:
<a href="http://external.domain.tld/" onclick="window.open(this.href, '_blank', 'width=512,height=512,left=200,top=100');return false"> open popup </a> this works fine, problem document loaded in popup window has permission change location of opener window. works when document in popup different domain. has no permission read location allowed change location. don't want that. want popup disconnected main page.
even without javascript doesn't work. when open other page in new tab using target="_blank" attribute tab still allowed navigate opener window , change location:
<a href="http://external.domain.tld/" target="_blank"> open in new tab </a> this code in opened document should not allowed:
<script> opener.location.href = "http://badsite.tld/"; </script> you can see live demo here. click 1 of 2 links open other page in popup or new tab loads third page in opener window. that's i'm trying prevent.
is there trick can use break connection between opener window , opened window? ideally opened window should not know opened other window @ all.
if page in child window in control, can assign null opener in child page:
window.opener = null; by making first statement in javascript.
if page not in control or in different domain, while opening:
popup = window.open(this.href, '_blank', 'width=512,height=512,left=200,top=100'); popup.opener = null;
Comments
Post a Comment