Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

javascript - (HTML)下载PDF文件,而不是单击时在浏览器中打开它们((HTML) Download a PDF file instead of opening them in browser when clicked)

I was wondering how to make a PDF file link downloadable instead of opening them in the browser?(我想知道如何使PDF文件链接可下载,而不是在浏览器中打开它们?)

How is this done in html?(如何在html中完成?) (I'd assume it's done via javascript or something).((我认为这是通过javascript或其他方式完成的)。)   ask by 404Error translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

With html5, it is possible now.(使用html5,现在有可能。)

Set a "download" attr in element.(在元素中设置一个“下载”属性。) <a href="http://link/to/file" download="FileName">Download it!</a> Source : http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download(来源: http : //updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...