开发者

open pdf file from 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜