
Apu
October 26, 2022 ›
#Javascript
›
#url
❌
JavaScript open URL in new tab without popup blocker
To open a URL in a new tab without being blocked by the browser, you need to use the window.open() method inside a function that must be triggered by the user.
If you call the open() method after loading the webpage, the browser will block it.
Example : Javascript open link in a new tab. #
<button onclick="myFunc()">Open url</button>
<script>
function myFunc(){
window.open('https://example.com')
}
</script>
Try it Yourself »
window.open() : here window is an object and the open() is a method of the window object. We don't need to specify the window object to call the open() method.
<button onclick="myFunc()">Open url</button>
<script>
function myFunc(){
open('https://example.com')
}
</script>
Try it Yourself »
save
listen
AI Answer
JavaScript open URL in new tab without popup blocker
0
To open a URL in a new tab without being blocked by the browser, you need to use the wind…
asked
Apu
0 answers
2915
To open a URL in a new tab without being blocked by the browser, you need to use the wind…
Answer Link
answered
Apu