PROVISIO DevBlog

How to Maximize New Chrome Browser Windows

Some SiteKiosk users want to open new SiteKiosk Chrome Browser Windows maximized. This can be achieved by using a small external script that is easy to add to SiteKiosk.

The script makes use of the SiteKiosk Object Model and looks like this:

SiteKiosk.WindowList.OnInsert = OnInsert; //Event that listens for new windows

//Function that is called when a new window has been added, gets the object that represents the new window as parameter
function OnInsert(skwin){
	//Check the window type, type 3 is an application window, which also applies to a new SiteKiosk Chrome window
	if(skwin.WindowType === 3)	{
		//Use the handle of the new window to maximize it
		SiteKiosk.WindowList.Maximize(skwin.Handle);
	}
}

The OnInsert event listens for new windows that are created while SiteKiosk runs. Once this happens, the OnInsert function is called and an object that represents the new window is available as a parameter. To identify a new Chrome window we need to look only for windows with type 3, which are application windows. Note that this would also match windows of other external applications you might run togehter with SiteKiosk. If you do not want those other windows to be maximized as well, you might consider using the ItemText property to refine the criteria of the if clause. Finally, we use the Maximize method, which we call using the handle of the new window as a parameter.

Copy the above script into an editor (e.g. Notepad) and save it as a Javascript file (e.g. MaximizeNewSKChromeWindows.js). Put the file in the folder ..\SiteKiosk\Html\.

Now add the file as an external script in SiteKiosk. Open the SiteKiosk configuration and go to Start Page & Browser -> Chrome Browser -> Customize -> Advanced -> On startup of SiteKiosk execute the following script file. Note that you need your Browser Toolbar settings set to an option that allows for new windows.

In case you are using the Start Screen with the Chrome Browser go to Start Page & Browser -> Chrome Browser -> Start Screen -> Customize -> Browser Skin -> Advanced -> Advanced -> On startup of SiteKiosk execute the following script file.

Please be aware that a configuration option to do the above without a script will be added to a future version of SiteKiosk.