The key to maximizing the browser window in Javascript is the window.resizeTo() function, which would resize the window to any specified size. The function somehow needs to get the screen’s width and height to be supplied as parameter, and the window itself need to be moved to the top left corner of the screen using the window.moveTo() function so that it will be displayed in full.

The following example will maximize the browser window as the page loads:

<html>
<head>
	<script language="JavaScript">
		window.moveTo(0, 0);
		window.resizeTo(screen.width, screen.height)
	</script>
</head>
</html>

The browser window will maximize if a user click on the URL as in the following example:

<html>
<head>
	<script language="JavaScript">
		function maximizeme(){
			window.moveTo(0, 0);
			window.resizeTo(screen.width, screen.height)
		}
	</script>
</head>
<body>
	<a href="javascript:onclick=maximizeme()">Maximize</a>
</body>
</html>

The function seem to longer be supported by modern browsers