Internet Explorer 9 policy setting is affecting window.postMessage

喜夏-厌秋 提交于 2019-12-10 15:16:16

问题


I have a window.postMessage in a JavaScript file. This appears to be failing in IE9 because of some policy settings. I can't figure out which policy it is. Does anyone have any ideas which one it could be?


回答1:


I believe that the key you are looking for is:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_CROSS_DOCUMENT_MESSAGING

If the above mentioned registry key is set then IE (all versions from what I can tell) will return undefined for the window.postMessage function.




回答2:


Let me further elaborate outside the comments. As you can see here:

http://javascript.info/tutorial/cross-window-messaging-with-postmessage

If I use a normal IE9 at home or the one at browserstack.com, the message loads fine inside the iframe. If I use our Intranet IE9 however, I get the following error in JS Console:

SCRIPT16385: Not implemented

cross-window-messaging-with-postmessage, line 1 character 1
SCRIPT1002: Syntax error 
all.js, line 1 character 1

It would seem to be some security setting that's preventing the postMessage call.



来源:https://stackoverflow.com/questions/13962032/internet-explorer-9-policy-setting-is-affecting-window-postmessage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!