【问题标题】:Open PDF in separate tab/window在单独的选项卡/窗口中打开 PDF
【发布时间】:2023-04-01 07:19:02
【问题描述】:

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

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

这会在当前选项卡中显示 PDF...如何在新选项卡或新窗口中打开它?

【问题讨论】:

    标签: asp.net html internet-explorer


    【解决方案1】:

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

      <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.
    

    【讨论】:

      【解决方案2】:

      将“target”属性添加到您的 A 标记中。例如:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-02-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多