July 4, 2009

How to Open a Page In Full Screen Mode using JavaScript




One of my team members had a requirement of opening up a page in Full Screen mode. He wanted that when a link on the page is clicked, the same page should be opened in Full Screen Mode. If you too have a similar requirement, then here’s how to do so:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Open Page FullScreen</title>
<
script type="text/javascript">
function
FullScreenMode(){
var win = window.open("", "full", "dependent=yes, fullscreen=yes");
win.location = window.location.href;
window.opener = null;
}

</script>

</
head>
<
body>
<
input id="Button1" type="button" value="Full Screen"
onclick="FullScreenMode()"/>
</
body>
</
html>
If you want the parent window to close when the new window opens in full screen mode, just add window.close(); as the last line in the JavaScript code.

Giving me +1 tells me you liked this article! Thanks in advance


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

4 Responses to "How to Open a Page In Full Screen Mode using JavaScript"
  1. Anonymous said...
    April 18, 2012 at 12:32 AM

    Hi Suprotim,

    I want my page should be open in full screen mode on page load. as after click on F11. do you have any idea on this.

    please help me.
    my email id is navjot.singh@drishinfo.com

  2. Anonymous said...
    May 21, 2012 at 2:21 AM

    Try calling fullscreen function on body onload.

  3. Anonymous said...
    May 31, 2012 at 10:36 PM

    Hello,

    Code provided not working in IE9

    Please help for it,it opens in full screen but goes into infinite mode and works once I press escape button.

  4. Anonymous said...
    July 23, 2012 at 8:07 AM

    This work great for common web browser http://xme.im/display-fullscreen-website-using-javascript

 

Copyright © 2009-2013 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions