Open new tab with jQuery

Created on: 30.07.2024 08:52
Last update: 30.07.2024 12:08

english 3706

Open new tab with jQuery

In most cases, you use the function in the link (target="_blanc") to open a new tab.
However, this doesn't always work. As an example, we take a link and use it to open a new tab.
In this, there is another link that should open a new tab.
But this no longer works because the browser thinks that your tab has already been opened and opens the new link in the same tab.

With the following code, all tabs are reopened without exception.

<script>jQuery('a[target^="_opennewtab"]').click(function() { return openWindow(this.href);}</script>

Copy the jQuery script into the header area of ​​your page and replace (target="_blanc") with (target="_opennewtab") in all your links that you want to open as a new tab.

As a link example:
<a href="url" aria-label="name" target="_opennewtab">

Average overall rating
 off 3 Reviews
Awarded 3 x 5  Stars
Why your email address?
If necessary, I will contact you to help you with the implementation.
Your email address will not be made public.
Is this post helpful to you?
Information(1)
General information
 Free advertising
Post counter
Current information status:
Categories: 9
Posts: 104
Support pages: 57
Downloads for members: 104
Download counter: 646
Reviews total72
Companies: 34
Support: 31
Information: 7