Last active
December 6, 2020 00:26
-
-
Save danieleremin/c5fbe14856e68fc9c8eb8d5d8db94b8a to your computer and use it in GitHub Desktop.
How to open a new window in front of the current one using JavaScript. Values can be changed for desirable result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NewWindow() { | |
window.open('page.html','about:blank','resizable=yes,scrollbars=yes,status=0,width=600,height=620'); | |
} | |
// Call the function when a button is clicked. | |
// NOTICE: This will not work on mobile devices. On mobile devices this would function the same way target _blank on <a> HTML tag would. (Opens in new tab) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you do not want an external javascript file or
<script>
tag you can just put the line of code directly into the HTML button (e.g.<button onclick="window.open('page.html','about:blank','resizable=yes,scrollbars=yes,status=0,width=600,height=620');")>Open</button>
).