Page 1 of 1

Hi, problem with closing window!

Posted: Mon Aug 06, 2012 2:04 am
by mekha

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<input type="button" value="Close this window" onclick="self.close()">
</body>
</html>
why my code doesnt work ?

Re: Hi, problem with closing window!

Posted: Mon Aug 06, 2012 4:03 pm
by califdon
Try onclick="window.close();"

Re: Hi, problem with closing window!

Posted: Wed Aug 08, 2012 2:00 pm
by tr0gd0rr
Is this a pop-up window? I don't think you can close a tab using self.close() or window.close(). Also, avoid the xhtml doctype these days. Instead start with

Code: Select all

<!DOCTYPE html>
<html>