After the AJAX request succeeds, window.open () is handled by the browser blocker pop-up window

Source: Internet
Author: User

I have been using window.open (URL) to open a new switch card loading page, and I found this situation when I used the Opera browser test today.

The first thought was window.open () browser compatibility issues, so try a-tag click, Form form submission, and window.open () to add "_blank" parameter of the way not.

Later, it might be a question of the AJAX request callback. Finally, Baidu told me a solution, as follows.

Workaround:

1, asynchronous to synchronous, that is: Async:false

2. Point the new window to an object, and then modify the object's URL, for example:

$ ('. Task '). bind (' click ',function() {    var w = window.open ();    $.ajax ({        ' POST ',        '/surveytask '        ,        ' json ',function  () {            w.close ();        },        function(res) {            = res.url;        }    

After the AJAX request succeeds, window.open () is handled by the browser blocker pop-up window

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.