Opening window into tab with in Chrome

Use this method when you need to open a new window into a tab and not into a popup window through javascript. This should work in most browsers if settings have not been altered.

function open_in_tab(url) {
   var win =, '_blank');

Opening window into tab after Ajax Call will only open into a tab if it’s result of direct user action. Must make javascript think clicking button is the result of button click after the ajax call. Danger of running ajax synchronously is page can freeze waiting for the request. You can open a window into a tab after an AJAX call with the following:

$('#btn').on("click", function(){
      type: 'POST',
      url: "ajax.php",
      data: {action: 'update'},
      dataType: 'json',
      context: document.body,
      async:false,   //Send Synchronously
      success: function(resp){  
         if(resp.success) {''); //Will open into a tab

Leave a comment