在safari中的javascript window.open [英] javascript window.open in safari
问题描述
我遇到了在safari(ipad和桌面版本)中打开一个围绕弹出窗口阻止程序的新窗口的问题。基本上我发现如果没有从click事件中调用window.open,safari会阻止弹出窗口。
I've run into an issue with opening a new window in safari (both ipad and desktop versions) that revolves around the popup blocker. Basically I've found that if window.open isn't called from a click event, safari will block the popup.
当前正在调用window.open的事件从列表框中改变。
The event that is calling window.open is currently onchanged from a list box.
除了切换我们处理哪个事件以欺骗safari以允许在这种情况下弹出窗口之外,还有什么方法吗? (onchanged事件)
Is there any way other than switching which event we handle to trick safari into allowing a popup in this scenario? (the onchanged event)
推荐答案
我认为有一种方法可以在移动设备中打开一个新窗口而不是从按一下按钮。请参阅此 StackOverflow问题。我不确定它是否可行,但您可以查看以编程方式触发按钮使用jquery的trigger()函数。
I don't think there is a way to open a new window in mobile safari other than from a button click. Refer to this StackOverflow Question which is similar. I'm not sure if it will work, but you can look at triggering a button click programatically using jquery's trigger() function.
您可能还想查看在您自己的页面中显示对话框的选项,可能使用jquery ui等工具。
You might also want to look at options of showing a dialog within your own page, maybe using tools like jquery ui.
HTH!
这篇关于在safari中的javascript window.open的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!