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……….!!!

550 total views, 1 views today

Leave a Reply

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