如何在不使用HTML的情况下强制超链接在新标签页中打开?

huangapple go评论58阅读模式
英文:

How can I force a hyperlink to open in a new tab without using HTML?

问题

我有一张图片。该图片链接到另一个网站。我希望用户能够点击该图片,并且链接会在新标签页中打开,这样用户在点击链接时不必每次都重新打开文档。

我尝试将图片转换为PDF,但无法找到文档脚本。我的Adobe可能太旧了。

附注:该图片托管在一个我无法控制HTML的网站上。它在一个市场上。我想将它链接到一个可以在新标签页中打开的免费样本,这样用户就不会失去购买的网站。

英文:

I have an image. The image is linked to another site. I would like to the user to be able to click that image and for the link to open in a new tab so that the user doesn't have to re-open the document every time they click a link.

I tried turning the image itno a pdf but could not locate the document scripts. My Adobe might be too old.

ETA: The image is hosted on a site where I do not control the html. It is on a marketplace. I would like to link it to a free sample that opens in a new tab so that the user won't lose the site where they can make the purchase.

答案1

得分: 1

以下是翻译好的部分:

使用HTML回答

<!-- 开始代码片段:js 隐藏:false 控制台:true Babel:false -->

<!-- 语言:lang-html -->
    
<a href="https://unsplash.com/photos/zgGPvJM7A98" target="_blank" rel="noopener noreferrer">
  <img src="https://source.unsplash.com/zgGPvJM7A98" alt="俯视蓝色海洋波浪" width="300">
</a>

<!-- 结束代码片段 -->

 - 添加 `target="_blank"` 属性会在新标签页中打开链接
 - 添加 `rel="noopener noreferrer"` 属性可防止新标签页恶意修改原始标签页


**使用Adobe Acrobat回答**
--------------------------

答案可以在他们的网站上找到 [这里](https://www.adobe.com/acrobat/resources/how-to-add-hyperlink-to-pdf.html)
按照以下步骤操作

> 1. 选择工具 › 编辑 PDF › 链接 › 添加或编辑。指针变成十字形,文档中的任何现有链接,包括不可见链接,都会暂时可见。

> 2. 拖动一个矩形到您想要创建链接的位置。无论是文本框还是图形,这将是链接活动的区域。

> 3. 在出现的“创建链接”对话框中,选择链接外观。可以选择使其不可见,或选择链接类型和突出显示样式,以及线条类型、样式、粗细和颜色。

等等。。。

<details>
<summary>英文:</summary>



I have added the answer in HTML below as you have not clarified whether you don&#39;t want to use this because you&#39;re using another programming language.

If you are attempting to do this in another program or programming language. Please add the appropriate tags to your OP as well as the program/language you are trying to use.

Answer using HTML
-----------------------------------------------

&lt;!-- begin snippet: js hide: false console: true babel: false --&gt;

&lt;!-- language: lang-html --&gt;

    &lt;a href=&quot;https://unsplash.com/photos/zgGPvJM7A98&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;
      &lt;img src=&quot;https://source.unsplash.com/zgGPvJM7A98&quot; alt=&quot;Top-down view of blue ocean waves&quot; width=&quot;300&quot;&gt;
    &lt;/a&gt;

&lt;!-- end snippet --&gt;

 - Adding the `target=&quot;blank&quot;` attribute opens it in a new tab
 - Adding the `rel=&quot;nooopener noreferrer&quot;` attribute prevents the new tab from maliciously modifying the original tab


Answer using Adobe Acrobat
--------------------------

The answer can be found on their website [here](https://www.adobe.com/acrobat/resources/how-to-add-hyperlink-to-pdf.html)
Following these steps

&gt; 1. Choose Tools › Edit PDF › Link › Add or Edit. The pointer becomes a crosshair, and any existing links in the document, including invisible links, are temporarily visible.

&gt; 2. Drag a rectangle where you want to create a link. Whether it’s a text box or graphic, this will be the area in which the link is active.

&gt; 3. In the Create Link dialog box that appears, choose your link appearance. Make it invisible, or choose the link type and highlight
style, as well as the line type, style, thickness, and color.

etc..



</details>



huangapple
  • 本文由 发表于 2023年5月28日 23:57:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76352346.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定