0

How to open a URL in a new tab using javascript without focus on the page you just opened.

For example the following code is placed on the index.html page.

<button onclick="link()">Click here</button>

<script type="text/javascript">
function link() {
    window.open('pages.html');
}
</script>

When the button is clicked, it will open a new tab, but focus directly on page.html page.

How to focus on the index.html page?

GeeJhon
  • 67
  • 6

1 Answers1

0

It'll either be a configuration setting in your browser or simply not possible.

Please take a look at these similar answers:

Miguel Mota
  • 20,135
  • 5
  • 45
  • 64