window.open popup getting blocked during click event

前端 未结 5 2037
刺人心
刺人心 2020-11-30 07:30

What I ultimately need to do is run an $.ajax() call and then after that is run, open a new window.

A use clicks on a \"Preview\" button that saves thei

5条回答
  •  盖世英雄少女心
    2020-11-30 08:10

    I ran into this problem recently and found this work-around:

    1) call window.open just before calling $.ajax and save window reference:

    var newWindow = window.open(...);
    

    2) on callback set location property of the saved window reference:

    newWindow.location = url;
    

    Maybe it will help you too.

提交回复
热议问题