Questions tagged «popup-blocker»


10
设置JQuery event.preventDefault()时,跳过window.open上的弹出窗口阻止程序
我想在超链接的click事件上有条件地显示一个JQuery对话框。 我有一个条件,例如关于condition1的请求,请打开一个JQuery对话,如果不满足condition1的条件,请导航到该问题的“ href”标记所引用的页面。 我可以在链接的click事件上调用函数。现在,该函数通过执行另一个URL(执行我的Spring控制器并返回响应)来检查上述条件。 所有工作完美,只有window.open被弹出窗口阻止程序阻止。 $('a[href*=/viewpage?number]').live('click', function(e) { e.preventDefault(); redirectionURL = this.href; pageId= getUrlVars(redirectionURL)["number"]; $.getJSON("redirect/" + pageId, {}, function(status) { if (status == null) { alert("Error in verifying the status."); } else if(!status) { $("#agreement").dialog("open"); } else { window.open(redirectionURL); } }); }); 如果我e.preventDefault();从代码中删除,popoup阻止程序不会阻止该页面,但是对于condition1,它随后会打开对话框以及打开“ href”页面。 如果我解决了一个问题,则会给另一个问题。我无法同时兼顾这两种情况。 您能帮我解决这个问题吗? 一旦解决,我还有另一个问题要解决,即导航对话的OK事件:)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.