In this article we are going to see how to have the browser resemble a fullescreen - through javascript. Usually it is not possible to trigger the fullscreen(F11) through javascript as it is a security issue. But we can have the statusbar, toolbar, addressbar, title bar of the browser hidden to resemble the fullscreen.
Let us take this scenario of setting the browser to fullscreen on click of a button.
1. We can open the current url in a new window using window.open method of javascript
window.open(URL,name,features,replace);
2.The features can now be configured by using the available items.
params = 'width=' + screen.availWidth;
params += ', height=' + screen.availHeight;
params += ', fullscreen=yes';
params += ', status=no,titlebar=no,location=0,top=0, left=0';
window.open(window.location, "fullscreentest", params);
The below link has the list of all available parameter and the values.
http://www.w3schools.com/jsref/met_win_open.asp
3. When this is done on a click of a button, we will be able to see the browser in fullscreen mode.
The complete code snippet is given below.
CodeSnippet
function fullscreen() {
params = 'width=' + screen.availWidth;
params += ', height=' + screen.availHeight;
params += ', fullscreen=yes';
params += ', status=no,titlebar=no,location=0,top=0, left=0';
window.open(window.location, "test", params);
}
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.
The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.