开发者

Opening a popup after receving message via postMessage

开发者 https://www.devze.com 2023-03-25 02:40 出处:网络
There is an iframe on my site which is hosted on another domain. It can communicate to the main site via window.postMessage. I do have a button on that iframe which calls a JS method on the main domai

There is an iframe on my site which is hosted on another domain. It can communicate to the main site via window.postMessage. I do have a button on that iframe which calls a JS method on the main domain, which then triggers a new window.

It all seems good but since the user click event is generated on the iframe domain and window is created on the main domain, browser thinks that this is an automated popup, and blocks.

Is the开发者_C百科re anything I can do to prevent browser from blocking the window?


since that is browser based you cannot overwrite browser settings. But you can use javascript "modals" which are very useful since they are not pop-ups but they don't have the functionality of an pop-up

0

精彩评论

暂无评论...
验证码 换一张
取 消