开发者

open pdf file from javascript?

开发者 https://www.devze.com 2023-01-12 22:12 出处:网络
How can I ret开发者_开发百科urn an Open/Save dialog box to a PDF file on the server using only javascript?

How can I ret开发者_开发百科urn an Open/Save dialog box to a PDF file on the server using only javascript?

I don't want the current pages location to change, however. Do I need to trigger an Iframe?


You can open a file with the window.open command. The prompt would depend on the user's settings as to what the default action should be.

<a href="#" onclick="window.open('http://linktoPDF', 'NewWin');">link</a>


Yeah, you'd have to use an iframe for that. You could use the style visible:false; or maybe set the height and width to 1px, but I don't know if display:none; would work. Know that for some browsers, and iframe adds to the history, but it sounds like that isn't a problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消