HTML open link in new tab
Links are found on almost all pages. Links permit clients to click their way from one page to another. Tab serves important while linking the page. Tabs are ideal for single page web applications or for website pages equipped for showing different sections. In this post, let's learn how to write HTML code for opening the link in a new tab.
Built Hyperlink with Anchor Tag
HTML anchor tag <a> is made for linking resources. The text within anchor opening and closing tags is displayed on the web page as a link. The anchor tag has href attribute that contains the location of the web page. The anchor tag consists of three parts - href attribute, name attribute and target attribute. The target attribute is responsible to open link in new tab.
Target Attribute
The target attribute specifies where to open the linked document. Like, there may need to open the document in the new tab, in a new window, in the same frame, in the parent frame. The 'target= "_ blank "' is used for opening the target page in a new tab. This is the usual option when using target attributes for linking to other pages.
<a href="http://www.etutorialspoint.com" target="_blank">etutorialspoint</a>
When someone clicks on the connection, it will open up in another tab, or conceivably another window relying upon the individual's browser settings.
Secure new tab
It is important to secure the pages you link to from tabnapping. The tabnapping can result in a page that you link to redirect to a fake login page. The rel attribute sets the relation between your page and the linked URL. The rel attribute set to noreferrer noopener to prevent a type of phishing known as tabnabbing from the pages you link to -
<a href="http://www.etutorialspoint.com" target="_blank" rel="noopener">etutorialspoint</a>
Related Articles
HTML Table Alternate Row Color using PHPDisplay a doc file in PHP from the database
HTML open link in new tab
Complete HTML Form Validation in PHP
Dynamically Add/Delete HTML Table Rows
Image popup on page load using HTML and jQuery
JavaScript display PDF in the browser using Ajax call
How to display PDF file in PHP from database
How to read CSV file in PHP and store in MySQL
How to create a doc file using PHP
PHP SplFileObject Standard Library
Simple File Upload Script in PHP
Sending form data to an email using PHP
Recover forgot password using PHP and MySQL
Php file based authentication
Simple PHP File Cache
How to get current directory, filename and code line number in PHP