我正在使用以下代码在IE中显示PDF文档:
<a class="menu" href="file://MyServer/MyFolder/MyFile.pdf">Click Me!</a>
这会在当前标签中显示PDF ...如何在新标签页中打开,或者最好在新窗口中打开?
答案 0 :(得分:6)
这是您在新窗口中显示的方式:
<a class="menu" href="file://MyServer/MyFolder/MyFile.pdf" target="_blank">Click Me!</a>
目标属性可以在其他窗口或同一窗口中打开任何链接(不仅仅是html或pdf)。阅读它here。
_blank Renders the content in a new window without frames.
_parent Renders the content in the immediate frameset parent.
_search Renders the content in the search pane.
_self Renders the content in the frame with focus.
_top Renders the content in the full window without frames.
答案 1 :(得分:4)
将“target”属性添加到A标记中。例如:
<a class="menu" target="_blank" href="file://MyServer/MyFolder/MyFile.pdf">Click Me!</a>