从网站打开弹出窗口而没有弹出窗口阻止程序捕获 [英] Opening Popup from website without Popup Blocker catching it
问题描述
我有一个奇怪的查询,我想使用asp.net,Jquery关闭浏览器/选项卡时,打开一个新窗口(一个弹出窗口),但我想绕过阻止该窗口的弹出窗口阻止程序,任何人都可以帮助我,当用户关闭浏览器/选项卡时如何打开弹出窗口,或任何其他可以帮助我实现此目的的替代方法.主要问题是我想忽略弹出窗口阻止程序.在 SO Post
i have a strange query, i want to open a new window (a popup), when the browser/tab is closed using asp.net, Jquery, but i want to bypass the popup blocker which blocks the window, can anyone help me with this, how can i open a popup when user closes the browser/tab, or any other alternatives which can help me achieve the same. the main problem is i want to ignore the popup blocker. on one the SO Post
我阅读以下示例可能会有所帮助:
i read the below example could help:
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");
}
});
});
});
我用$(window).unload
代替了click事件,但这也没有帮助.弹出窗口不会打开,但是当我删除e.preventDefault();
时,弹出窗口会打开,但要求启用弹出窗口阻止程序.
i replaced the click event with $(window).unload
but that too didnt helped. the popup does not opens, but when i remove e.preventDefault();
the popup opens, but require the popup-blocker be enabled.
推荐答案
我认为没有办法解决弹出窗口阻止程序.
I don't think there's a way to go around pop-up blockers.
您应该更改方法,并尝试在 jQuery UI模式对话框中打开内容,而不是使用实际的浏览器窗口弹出窗口.
You should change the approach and try to open the content in a jQuery UI modal dialog box, instead of using an actual browser window popup.
这篇关于从网站打开弹出窗口而没有弹出窗口阻止程序捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!