0
Html code for open two tab same script
In browser I open two tab for same url using javascript
1 Answer
0
This works in my mobile built-in browser. In chrome it refuses to open the second tab, chrome keeps just 1 tab.
<!DOCTYPE html>
<html>
<head>
<title>Open link in two new tabs</title>
</head>
<body>
<button type="button" id="btnOpen">w3schools website</button>
</body>
<script>
const url = "https://www.w3schools.com";
btnOpen.onclick = () =>
{
for(let i = 0; i < 2; i++)
{
window.open(url, "_blank");
}
}
</script>
</html>