简体   繁体   English

window.opener.parent在Microsoft Edge上不起作用

[英]window.opener.parent doesn't work on Microsoft Edge

I open a window using 我打开一个窗口

window.open();

After processing on that window I want to write the data in Parent Window element using : 在该窗口上处理后,我想使用以下方法在Parent Window元素中写入数据:

var html_high = '<img width="600" src="assets/images/abc.jpg" alt="Image">';
var high = window.opener.parent;
$('#image_area',high.document).html(html_high);

$('#image_area',high.document).html(html_high); This doesn't work and gives an error in console only in Microsoft Edge 40.15063.0.0 : 这不起作用,仅在Microsoft Edge 40.15063.0.0中的控制台中出现错误:

"SCRIPT65535: Invalid argument" “SCRIPT65535:参数无效”

The above code works on all browser including IE 11,10,9, chrome, mozilla and safari. 上面的代码适用于所有浏览器,包括IE 11,10,9,chrome,mozilla和safari。

This is a known issue with MS Edge. 这是MS Edge的已知问题。 You could try storing a reference to the newly opened window and try logging it out to see if there are other properties that have what you are looking for. 您可以尝试存储对新打开的窗口的引用,并尝试将其注销以查看是否有其他属性具有您要查找的内容。 No real workarounds that I have seen. 我没见过真正的解决方法。 https://connect.microsoft.com/IE/feedback/details/828050/ie-11-when-opening-a-new-window-from-another-window-opener-is-undefined https://connect.microsoft.com/IE/feedback/details/828050/ie-11-when-opening-a-new-window-from-another-window-opener-is-undefined

MDN's explanation: MDN的解释:

When a window is opened from another window (using Window.open or a link with its target attribute set), it maintains a reference to that first window as window.opener. 当从另一个窗口打开一个窗口时(使用Window.open或其目标属性集的链接),它会将该第一个窗口的引用维护为window.opener。 If the current window has no opener, this method returns NULL. 如果当前窗口没有开启器,则此方法返回NULL。

Windows Phone browser does not support window.opener (tested with Microsoft Edge 25.10586.36.0). Windows Phone浏览器不支持window.opener(使用Microsoft Edge 25.10586.36.0测试)。 It is also not supported in IE if the opener is in a different security zone. 如果开启者位于不同的安全区域,则IE中也不支持它。

In some browsers, a rel="noopener" attribute on the originating anchor tag will prevent the window.opener reference from being set. 在某些浏览器中,原始锚标记上的rel =“noopener”属性将阻止设置window.opener引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM