问题
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