Pregunta

I need to modify a form submission script to open a PDF in a new tab upon success.

As it stands, when it succeeds, it already shows a notice of thanks and clears the form. I just need the jQuery to open the PDF in a new tab. I've only been able to open a new window with window.open(), which is promptly blocked as a pop-up.

¿Fue útil?

Solución

You can't directly control this; it's down to the browser and its settings.

jQuery is JavaScript, so there's nothing jQuery can possibly provide that isn't available to you in native JS, and all JS provides is window.open(), which, as you've found out, is normally blocked unless it's the result of a (real, not simulated) click event.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top