Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I do not want to open up a URL. Instead, I want to open up a blank screen/new blank page. How do I achieve this?

Thank you in advance!

What I have tried:

The code I have so far is this:

JavaScript
document.addEventListener('keydown',function(e){
    if(e.keyCode==65)//key code for 'a'
        location="http://google.com"
})
Posted
Updated 3-Jun-19 19:59pm
v2

1 solution

Try this

HTML
<!DOCTYPE html>
<html>
<body>

<p>Click the button to open a new browser window.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  window.open("https://www.xyz.com");
}
</script>

</body>
</html>


Reference : Open new tab : W3School[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900