强制打开“另存为..."在文本链接处打开弹出窗口单击 HTML 中的 PDF [英] Force to open "Save As..." popup open at text link click for PDF in HTML

查看:24
本文介绍了强制打开“另存为..."在文本链接处打开弹出窗口单击 HTML 中的 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一些大尺寸的 PDF 目录,我需要将它们作为下载链接.当我用谷歌搜索时,我发现了下面提到的这样一个事情.它应该在链接点击时打开另存为..."弹出窗口...

I have some big size PDF catalogs at my website, and I need to link these as download. When I googled, I found such a thing noted below. It should open the "Save As..." popup at link click...

 <head>
    <meta name="content-disposition" content="inline; filename=filename.pdf">
    ...

但它不起作用:/当我链接到如下文件时,它只是链接到文件并试图打开文件.

But it doesn't work :/ When I link to a file as below, it just links to file and is trying to open the file.

    <a href="filename.pdf" title="Filie Name">File name</a>

<小时>

更新(根据以下答案):

据我所知,没有 100% 可靠的跨浏览器解决方案.可能最好的方法是使用下面列出的网络服务之一,并提供下载链接...

As I see there is no 100% reliable cross-browser solution for this. Probably the best way is using one of the web services listed below, and giving a download link...

推荐答案

来自对点击链接后强制浏览器保存文件:

<a href="path/to/file" download>Click here to download</a>

这篇关于强制打开“另存为..."在文本链接处打开弹出窗口单击 HTML 中的 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆