admin管理员组文章数量:1417442
How can I return 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?
How can I return 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?
Share Improve this question asked Aug 25, 2010 at 21:12 Scott KlarenbachScott Klarenbach 38.8k16 gold badges63 silver badges92 bronze badges 4- The only thing I can make of that is an illogical thing to do, could you explain your question in some more detail? – Jasper Commented Aug 25, 2010 at 21:15
- I've got a one page application w/ plex UI via ExtJS. Currently reports are firing by opening up another tab in the browser. Instead, I want to fire an Open/Save dialog via javascript without opening a new tab, and without changing the location of the current tab. I've seen it done before, but can't find the code. – Scott Klarenbach Commented Aug 25, 2010 at 21:17
- Why not simply have the webpage download the file, and let the browser handle popping up the "Open? Save?" dialog? – rlb.usa Commented Aug 25, 2010 at 21:20
- I don't want the page to change. It's not a webpage, but an application that is loaded into the current url and maintained by javascript. – Scott Klarenbach Commented Aug 25, 2010 at 21:22
2 Answers
Reset to default 2You can open a file with the window.open
mand. 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.
本文标签: open pdf file from javascriptStack Overflow
版权声明:本文标题:open pdf file from javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745264327a2650505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论