asp.net - 在单独的选项卡/窗口中打开 PDF

标签 asp.net html internet-explorer

我正在使用以下代码在 IE 中显示 PDF 文档:

<a class="menu" href="file://MyServer/MyFolder/MyFile.pdf">Click Me!</a>

这会在当前选项卡中显示 PDF...我如何才能在新选项卡或新窗口(最好是新窗口)中打开它?

最佳答案

这是你在新窗口中的显示方式:

  <a class="menu" href="file://MyServer/MyFolder/MyFile.pdf" target="_blank">Click Me!</a>

target 属性可以在其他窗口或同一窗口中打开任何链接(不仅仅是 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.

关于asp.net - 在单独的选项卡/窗口中打开 PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8174262/

相关文章:

c# - 您如何动态分配母版页?

c# - html helper 接受一个字典<string,object>,如何使用这个参数?

javascript - 我如何才能准确识别事件监听器从中触发的元素?

html - ASP.NET:GridView 在 HTML 表格中的背景也改变颜色(鼠标悬停)

asp.net - IE10 User-Agent导致ASP.Net不发回Set-Cookie(IE10不设置cookie)

excel - 为什么 "get Elements By Name"不起作用?

javascript - 如何在没有jQuery的情况下在IE中使用javascript触发元素的onchange事件

c# - 在 C# 中动态减小图像尺寸和图像大小

html - 淡出 div 的 Angular ——在不同的背景下

asp.net - 我有一个存储过程需要从同一个表中提取信息两次。如何使用关联名称?