English 中文(简体)
如何以超文本形式打开新表格中的链接?
原标题:How to open link in a new tab in HTML?

I m从事超文本项目工作,我可以发现如何在新表格中打开一条没有 Java本的链接。

我已经知道,<a href=”http://www.WEBSITE_NAME.com></a>在同一表格中打开了链接。 如何在新问题上打开大门?

最佳回答

Seting the target Depende of thelink to _blank:

<a href="#" target="_blank" rel="noopener noreferrer">Link</a>

其他例子见:。 http://www.w3schools.com/tags/att_a_target.asp


Note

我以前曾建议过<代码>空白,而不是<代码>_blank,因为如果使用,就会打开新的表格,然后如果再次点击同一条表格。 但是,这只是因为,正如GolezTrol所指出的,它指的是一个框架/窗口的名称,如果该链接再次用同一表格打开,该名称将予以确定和使用。


Security Consideration!

rel=“no opener noreferer”,是为了防止新开的表格恶意更改原表格。 关于这种脆弱性的更多信息,请参阅以下条款:

问题回答

根据您的要求使用其中一项。

在新的窗口或表格中打开链接文件:

 <a href="xyz.html" target="_blank"> Link </a>

Open the linked document in the same frame as it was clicked (this is default):

 <a href="xyz.html" target="_self"> Link </a>

在母体框架内开放相关文件:

 <a href="xyz.html" target="_parent"> Link </a>

在窗口的全身开放相关文件:

 <a href="xyz.html" target="_top"> Link </a>

在指定框架内开放相关文件:

 <a href="xyz.html" target="framename"> Link </a>

If you would like to make the command once for your entire site, instead of having to do it after every link. Try this place within the Head of your web site and bingo.

<head>
<title>your text</title>
<base target="_blank" rel="noopener noreferrer">
</head>

希望这一帮助

使用target=_blank":

<a href="http://www.example.com/" target="_blank" rel="noopener noreferrer">This will open in a new window!</a>

www.un.org/Depts/DGACM/index_spanish.htm 在使用<代码>target=_blank 时:

www.un.org/Depts/DGACM/index_spanish.htm 超文本 (一些装置不支持:

<a href="http://chriscoyier.net" target="_blank">This link will open in new window/tab</a>

www.un.org/Depts/DGACM/index_spanish.htm 所有装置的 Java本:

“外部”的使用完全有效。

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
    $( a[rel="external"] ).attr( target ,  _blank );
</script>

<>0> Jquery可尝试以下一种:

$("#content a[href^= http:// ]").attr("target","_blank");

www.un.org/Depts/DGACM/index_spanish.htm 如果浏览器的设置不允许你打开新的窗口:

href = "google.com";
onclick="window.open (this.href,   ); return false";

您可使用<代码>target因在新表格中开辟一条链接:

<a href="https://google.com" target="_blank">Google Link</a>

<>>>>

<a href="https://google.com" target="blank">Google Link</a>

<>><>>

<>_blank将永远打开新表格中的链接。

blank将在首次开放的新表格中打开这一链接,但所有开放之后都将重新使用/更新现有的表格。

您可以使用:

<a href="http://www.WEBSITE_NAME.com"  target="_blank"> Website</a>

然而,以上所述使贵方很容易遭受营养攻击。 你们可以通过在你的联系中增加“不开放”字眼,防止它在某些浏览器中发生。 加上这一点,上述例子成为:

<a href="http://www.WEBSITE_NAME.com" rel="noopener noreferrer" target="_blank">Website.com</a> 

check out for more information: https://www.thesitewizard.com/html-tutorial/open-links-in-new-window-or-tab.shtml

你可以这样做:

<a href="http://www.WEBSITE_NAME.com" target="_blank" rel="noopener noreferrer">Open</a>

最初是:

<a href="http://www.WEBSITE_NAME.com"></a>

• 查阅关于安全和隐私的更多信息:

https://developer.mozilla.org/en-US/docs/Web/spanish/Element/a# Security_and_privacy

which in turn has a link to a good article named Target="_blank" - the most underestimated vulnerability ever:

https://www.jitbit.com/alexblog/256-targetblank--the-est-underyatd-vulnerability-ever/

The simple way to open the link in a new tab is to add a target attribute in the link having a value equals to "_blanl", like this :

<a href="http://www.WEBSITE_NAME.com" target="_blank"></a>

If anyone is looking out for using it to apply on the react then you can follow the code pattern given below. You have to add extra property which is rel.

<a href="mysite.com" target="_blank" rel="noopener noreferrer" >Click me to open in new Window</a>

In case of React, if anyone wants to open link in a new tab. Please use from react-router-dom, because <a href="/path"></a> refresh full page, even though if your page changes only some text or image on the new route. For Link usage please refer here





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签