Edge will block the popup window when we call Window.showModalDialog or Window.Open in IE Mode with below conditions.
- The configuration of “Use Pop-up Blocker” is enable in the zone security settings which the URL belongs to.
- There is a MSGBOX or ALERT before calling Window.showModalDialog or Window.Open
Cause:
It should be a bug in IE.
When there is a MSGBOX or ALERT before calling to Window.showModalDialog or Window.Open in IE Mode, the API GetAsyncKeyState return false. Then the dwFlag used by EvaluateNewWindow will be 0x24, which means that browser will not treat it as a user-initiated action. So Edge blocked the Window.
Resolution:
Workaround is adding the URL to local intranet zone where the configuration of “Use Pop-up Blocker” is disable by default.
Notes:
Allow pop-up windows on specific sites does not workaround this issue.
Repro Steps:
- Add brave-plant-0ddc21400.3.azurestaticapps.net to IE Mode List and add the URL to trust site zone. (make sure that “Use Pop-up Blocker” is enabled. By default the configuration is enabled)
- Access brave-plant-0ddc21400.3.azurestaticapps.net/TestModalDialog.html and then click “showModalDialog” button.
Expected behavior: We can see the Modal Dialog.
Actual behavior: The modal dialog is blocked by Edge.
文档信息
- 本文作者:Robin Chen
- 本文链接:https://crushonme.github.io/2023/09/11/Edge-Block-Popup-Window/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享4.0许可证)
Document Information
- Author :Robin Chen
- Link : https://crushonme.github.io/2023/09/11/Edge-Block-Popup-Window/
- Copyright:Attribution-NonCommercial-NoDerivatives-No additional restrictions(CC BY-NC-ND 4.0)