Javascript href onclick open new window

Javascript href onclick open new window

Javascript code to open new window:“”) – opens in new window.“”,”My window”) – My window is the name of the new window.

Javascript code to close the current window:

window.close() – close the current opened window.
It will ask the popup confirmation.

Javascript code to close without popup confirmation:'','_self');
window.close();""); // It wont allow to go back
window.location= "./home.jsp"; (Relative path) // allow to go back
window.location ="" (Absolute path) // allow to go back



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Rational Application Developer">
<script type="text/javascript">
function newWindow(url){;

<a href="#" onclick="newWindow('')"/>new window</a>



Click to open new window


google on new window open




Thanks for reading this post……….!!!

1,338 total views, 2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.