Specifying multiple targetOrigin uris in postmessage

血红的双手。 提交于 2019-12-08 19:46:24

问题


Window.postMessage() has a targetOrigin parameter that can be set to a URI (to ensure the message reaches only a specific url). It can also be set to * of course (not recommended), but is there a way to specify multiple URIs as allowed?

At present I'm simply firing off one postMessage() call for each domain, but this seems a bit hacky to say the least.


回答1:


Unfortunately you can't. You should either provide "*" or single specified domain.



来源:https://stackoverflow.com/questions/35939798/specifying-multiple-targetorigin-uris-in-postmessage

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