我有一个奇怪的查询,我想打开一个新的窗口(弹出),当浏览器/选项卡关闭使用asp.net,jquery,但我想绕过弹出式窗口阻止程序阻止窗口,任何人都可以帮助我,当用户关闭浏览器/选项卡或任何其他可以帮助我实现的选项时,我如何打开弹出窗口。主要问题是我想忽略弹出式窗口拦截器。在一个SO Post打开弹出窗口从网站没有弹出窗口拦截器捕获它
我读了下面的例子可以帮助:
jQuery(function($) {
// This version does work, because the window.open is
// during the event processing. But it uses a synchronous
// ajax call, locking up the browser UI while the call is
// in progress.
$("#theButton").click(function(e) {
e.preventDefault();
$.ajax({
url: "http://jsbin.com/uriyip",
async: false,
dataType: "json",
success: function() {
window.open("http://jsbin.com/ubiqev");
}
});
});
});
我更换了click事件与$(window).unload
,但同样didnt帮助。弹出窗口不会打开,但当我删除e.preventDefault();
时弹出窗口打开,但需要启用弹出窗口阻止程序。
在这些情况下,您不能“跳过”弹出式窗口拦截器,因为它是为了阻止这种确切的事情发生而创建的。 – Archer
我怎样才能进入诺克斯堡?里面有一些漂亮的黄金,但是他们把那些讨厌的卫兵放在那里。 –
@Archer错误,OP使用同步AJAX,所以这是可能的。 –