我可能在这里遗漏了一些简单的东西,但无论如何我都会问.我已经建立了一个打开PDF文件的链接,但它在当前标签中打开而不是新标签.我应该在HTML中使用什么代码来打开新标签来阅读PDF文件.
<div class="footer_box_content">
<div class="cleaner_h10"></div>
<p>Many thanks to everyone who cleared snow and ice during the cold spell in February.
Should Arctic conditions return, each block has a shovel and a jar of rock salt to clear the steps.
Please click more to read the full newsletter.</p>
<div class="button_01"><a href="newsletter_01.pdf">Read more</a></div>
</div>
Run Code Online (Sandbox Code Playgroud)
Chr*_*ris 44
<a href="newsletter_01.pdf" target="_blank">Read more</a>
Run Code Online (Sandbox Code Playgroud)
目标_blank将强制浏览器在新窗口中打开它
Chu*_*utt 33
正如其他人都指出的那样,这可以起作用:
<a href="newsletter_01.pdf" target="_blank">Read more</a>
Run Code Online (Sandbox Code Playgroud)
但没有人指出的是它不能保证工作.
无法强制用户的浏览器在新选项卡中打开PDF文件.根据用户的浏览器设置,即使target="_blank"浏览器可能会有以下几种反应:
看看Firefox的设置,例如:
Chrome有类似的设置:
如果用户在遇到PDF时选择在其浏览器设置中"保存文件",则无法覆盖它.