How to prevent popup blocking when post ajax return?

2

Follow the code below:

JS:

function OnSuccess() {
    var url = "/Controller/VisualizarBoleto/" + 00;
    window.open(url, "WindowPopup", 'width=668,height=780');
}

Theproblemisnotdisplayingpopup,thebrowserisblocking.

Iknowyoucanunblockusingyourbrowserconfiguration.

Isthereanotherwaywithoutgoinginthebrowserconfiguration?

Becausea"newbie" who does not know what is happening with the site (popup blocked), he will never know if it is blocked. So I asked a question about how to prevent popup blocking.

I made a small example: link

How can I avoid this?

    
asked by anonymous 01.05.2017 / 23:54

1 answer

4

It seems that popup blockers always try to bar when the popup is not the result of a user action .

  

One possible solution is to remove your window.open function from within OnSuccess and move to a button.

Example in jsfiddle

Another option would be to try to use an iframe, which may overlap other elements on the page, and is not blocked by browsers.

See an example using iframe

And I do not think you can quit a "ready" option:

modal of Bootstrap .

    
02.05.2017 / 02:04