1. 程式人生 > >window.open跳過瀏覽器攔截

window.open跳過瀏覽器攔截

pre cli clas ati open click var () url

轉自https://www.cnblogs.com/shizk/p/8458916.html

$(‘#btn‘).click(function () {
        //打開一個不被攔截的新窗口
         var newWindow = window.open();
          $.ajax({
                    url: ‘xxxx.com‘,
                     success: function (url) {
                           //修改新窗口的url
                      newWindow.location.href = url;
                   }
            })
 });//先在回調函數之前打開新窗口,後再加載url

window.open跳過瀏覽器攔截