This quick JavaScript tutorial help to open a linked URL in a new browser window or tab. The HTML is anchor '<a>'
tag that ll use to open a URL into the new tab using JavaScript.
HTML a target attribute provides an easy way to open a URL into the new browser window or tab. We’ll use _blank value in the target attribute to open the linked URL in a new tab or window.
<a href="https://phpflow.com" target="_blank">Visit Phpflow</a>
Above code, ll open phpflow.com into the new tab using pure HTML.
But If you want to open a URL with JavaScript. The JavaScript window.open() method is used to open a new browser window depending on the browser setting and the parameter values.
You can pass _blank as the second parameter into the window.open()
method to open a URL in a new tab using JavaScript.
The following JavaScript code will open https://phpflow.com
in a new browser tab or window.
window.open('https://phpflow.com', '_blank');
Full Source Code:
<html> <body> <p>Click the button to open a new tab </p> <button >
This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More
in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More