javascript 如何指示 Safari 已阻止弹出窗口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5649962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 17:54:51  来源:igfitidea点击:

How can I indicate that a popup has been blocked by Safari?

javascriptipadsafari

提问by testndtv

In Safari for iPad, if the popups are disabled, is there any way to get the bar at the top..like in IE which says "...website trying to open popup.."

在 iPad 的 Safari 中,如果弹出窗口被禁用,有没有办法让栏位于顶部..就像在 IE 中显示“......网站试图打开弹出窗口......”

I mean the user can at least come to know there is some popup being opened..

我的意思是用户至少可以知道有一些弹出窗口正在打开..

Otherwise if the popup setting is blocked, nothing happens when the user clicks on a link which has that popup.

否则,如果弹出设置被阻止,则当用户单击具有该弹出窗口的链接时不会发生任何事情。

回答by Groovetrain

The only way that I know of to get a new window to open up in Mobile Safari is to use the target="_blank"(and I guess target="_new") attribute.

我所知道的在 Mobile Safari 中打开新窗口的唯一方法是使用target="_blank"(我猜target="_new")属性。

<a href="my_popup_page.html" target="_blank">Open 'popup'</a>