[英]Download a PDF via Ajax and Open in a New Browser Tab
I need to download a pdf via ajax request then open it in a new tab. 我需要通过ajax请求下载pdf,然后在新选项卡中打开它。 I know that major browsers discourage this but is this possible?
我知道主流浏览器不鼓励这样做,但这可能吗?
I currently use window.open then execute the pdf download in the new window. 我目前使用window.open然后在新窗口中执行pdf下载。
The problem with window.open
and target="_blank
" is that most browsers will block this as a popup. window.open
和target="_blank
”的问题是大多数浏览器会将其作为弹出窗口阻止。 target="_self"
works fine though but is not the desired behaviour target="_self"
工作正常,但不是理想的行为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.