Html code for open two tab same script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Html code for open two tab same script

In browser I open two tab for same url using javascript

2nd Jul 2020, 12:08 PM
Shanmuga Sundaram
Shanmuga Sundaram - avatar
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>
2nd Jul 2020, 3:30 PM
Ipang