Open 2 pages in one hyper link

I want to open one page in the current tab as well as a page in a new tab in my sample code.
Here is what I have so far, just opening a page in a new tab, I also know that if I set no target it will open in the current tab. how do I add another page to open two sites with one hyperlink.

Josh Sample Page

Test page title, link below

Test Link

47

1 Like

Ain’t gonna happen. Sorry. The nomenclature describes it as a, hyperlink, which is singular.

1 Like

It can’t be done, but you can do it in javascript (but not with one hyperlink but with one anchor <a> tag).
With the window.open("https://www.youradress.com", "_targettype") method.
First attribute is the link what you want to open and the second is the targeting type, _self opens in the same tab and _blank opens in new tab, click me to learn more about anchors
But anyway here’s the code
HTML:

<a id="anchor" href="https://codecademy.com" target="_blank">open</a>

JS:

const anchor = document.getElementById("anchor");
anchor.onclick = function() {
  window.open("https://codecademy.com","_self")
}

Hope this helps :grinning:

Yeah, I’ll try it out, thanks.

1 Like

is there a way to do it with a button or function or something, any way using just html?

1 Like

No there isn’t any way to do it with HTML only, sorry.