window.open popup getting blocked during click event

前端 未结 5 2040
刺人心
刺人心 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:06

    Popup blockers usually works blocking every popup shown not triggered by a direct user action, like clicking on a button or a link.

    If you use a ajax request on your click event, the request is fired asyncronous from the click event, that's why by the time the ajax request has done its job and you get your event with the response from the request you have lost your chance to trigger a window.open withouth the popup blocker getting in the way, the original click event it's long dead by that time.

提交回复
热议问题