Open maximised window (JavaScript)

The following will open a maximised window, with scrollbars, menubar, but no toolbar (only works with links to pages on the same site - ../folder/file.htm or /folder/file.html not http://www.google.com - Access denied error will occur):

function showDocument(sDocURL){
	var newwin = window.open(sDocURL,'newwin','scrollbars=yes,toolbar=no,menubar=yes');
	newwin.window.moveTo(0,0);
	newwin.window.resizeTo(screen.availWidth,screen.availHeight);
	newwin.focus();
	return false;
}

Call function as follows: <a href="../folder/file.htm" onclick="showDocument(this.href); return false">File</a>
Will set focus on page and replace any existing page that was called in the same way.

Comments

Popular posts from this blog

Link: HTML Agility Pack (.NET)

Basic Excel Spreadsheet Generation (ASP/ASP.NET)

ASP.NET: Binding alphabet to dropdown list