How to open new window with window.open and not be seen by chrome a popup

How to open new window with window.open and not be seen by chrome a popup

If in the command stack the window.open is not direct under the onClick event then the new window it must be a popup. If the browser is set to block popups the new window will be blocked.

Now in the WEB 2.0 world where ajax calls are a must opening a window after a success ajax call will be seen as a popup Window and Chrome will block this.

What is left to do then?
Ask the users to activate popups?
It is working but … I don’t think that is the behavior that is wanted.
So …

So let do some tricks with Chrome.Watch movie online Logan (2017)

If we have a function like


// Working example with Google Chrome 19
jQuery("#somethink").click(function(){
     var myPopup = window.open (url, '', ''); // and the url is from the same server where we call it the popup will be opened by chrome

     // now we do the ajax call
     do_the_ajax_call(myPopup);
})

function do_the_ajax_call(myPopup){
     jQuery.ajax({
          url: "... my_url ...",
          type: "POST",
          success: function(data){
               myPopup.location = theNewURL;
          }
     });
}

When we open the popup is on stack under the onClick event and on the same domain so this is not a popup.Now we just have to pass the new window as a variable to the jQuery and in success just change the location to the new URL.

No comments.