Home / ASP.NET Wiki / Javascript / Javascript - mimic browser Fullscreen

Javascript - mimic browser Fullscreen

 Rate It (0)

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);

        }

 

Revision number 1, Wednesday, December 29, 2010 12:28:23 PM by clklachu

Comments

Related Articles

Javascript

JavaScript holds it all together on the client side. There are a number of extensions that have been made to improve and expand base JavaScript object functionality. Blog Posts Four ASP.NET AJAX JavaScript UI Methods You Should Learn: Dave Ward describes more

Avoid errors in Javascript

Many times we see some annoying javascript errors on websites. I am of the opinion that the javascript errors should not be shown to users. Best way is to write correct javascript, but to be on safer side we can write try...catch in javascript to supress the

AJAX Localization and Globalization

Internationalizing AJAX and JavaScript can be a little trickier than just internationalizing a plan HTML page. Guy Smith-Ferrier on Internationalization - A great PDF slide deck of a talk that Guy did on AJAX and i18n. Localizing Resources for Component Libraries

javascript replace() function replace only single characters

javascript replace() function replace only single characters I have been trying to use javascript replace() to search and replace special individual characters in a string. But having some difficulties. We can use the following way to solve the following problem

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)