jquerypopup-blocker

Opening Popup from website without Popup Blocker catching it


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");
      }
    });
  });
});

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.


Solution

  • I don't think there's a way to go around pop-up blockers.

    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.