PostMessage from a sandboxed iFrame to the main window, origin is always null

前端 未结 2 723
日久生厌
日久生厌 2021-02-19 21:23

There\'s something I don\'t get about the event origin with javascript postMessage event.

Here is my main page:




Test

2条回答
  •  梦谈多话
    2021-02-19 21:58

    Since the iframe is sandboxed it lost access to its origin data.

    adding allow-same-origin to the iframe sandbox property will make it work again.

提交回复
热议问题