Html 如何使用html在新选项卡中打开pdf文件的链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2947404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:16:58  来源:igfitidea点击:

How to open link to pdf file in new tab using html

htmlfilepdfhyperlink

提问by AsM

I have an html page which contains link to open pdf file. however this link opens in adobe reader when i click on it. I have set target property to blank. but it doesn't work either. I want to open this pdf file in new tab in the same window.

我有一个 html 页面,其中包含打开 pdf 文件的链接。但是当我点击它时,这个链接会在 adobe reader 中打开。我已将目标属性设置为空白。但它也不起作用。我想在同一窗口的新选项卡中打开这个 pdf 文件。

回答by oezi

target="_blank"is the right way - but if it opens in a new tab, a new window or the adobe reader depends on the users browser-settings and can't (and shouldn't!) be controlled by you.

target="_blank"是正确的方法 - 但如果它在新选项卡、新窗口或 Adob​​e Reader 中打开取决于用户的浏览器设置,并且不能(也不应该!)由您控制。

回答by AsM

With my websites, I use:

对于我的网站,我使用:

target="_tab"as most browsers are now aware that people want things to open in new tabs instead of new windows. I can confirm that this works for me in the following web browsers:

target="_tab"因为大多数浏览器现在都知道人们希望在新选项卡而不是新窗口中打开内容。我可以确认这在以下 Web 浏览器中对我有用:

Opera, Chrome, Flock, Firefoxand Maxthon.

OperaChromeFlockFirefoxMaxthon

However, it still does notwork in any version of Internet Explorer, including their new beta version: 9. Apparently it comes down to "User Preferences" with Internet Explorer.

然而,它仍然不能在任何版本的 Internet Explorer 中工作,包括他们的新测试版:9。显然它归结为 Internet Explorer 的“用户首选项”。

Determining which application opens a particular file format is currently, and should always be left up to the user, not the developer*.

确定哪个应用程序打开特定文件格式是当前,并且应该始终由用户决定,而不是开发人员*。