-1

I should be able to click on second text which leads me to a new website of my choice in a new tab.

var search = "First text";
var replacement = "Second text";

document.body.innerHTML = document.body.innerHTML.split(search).join(replacement);
Player PhB
  • 49
  • 1
  • 6

1 Answers1

0

You can use the window.open() function with an extra parameter (target) set as '_blank' to achieve this. Although you can't control whether it will be a new tab, as it is based on the local browser settings the user is working on, however you can force it to open in a popup.

Refer to this answer: Chrome, Javascript, window.open in new tab