Browser Fullscreen API using Javascript

Usefull new Javascript API, very simple and useful fullscreen API using Javascript API. The full screen API is an easy way to get the full web content to be displayed on the page. Here the programmatic way to request fullscreen display from the user, and exit fullscreen when request from the user. When it comes to creating special end user experiences have been the ability to show something fullscreen. This can be done at the developers choice, it’s very similar to F11 processing on your keyboard.




demo

Check If The Browser Supports Full Screen API

We now have access to a method called requestFullScreen, so far implemented in Firefox, Google Chrome, Safari and Internet Explorer.

			var docElm = document.documentElement;
			if (docElm.requestFullscreen)
			{
				docElm.requestFullscreen();
			}
			else if (docElm.msRequestFullscreen)
			{
				docElm.msRequestFullscreen();
			}
			else if (docElm.mozRequestFullScreen) 
			{
				docElm.mozRequestFullScreen();
			}
			else if (docElm.webkitRequestFullScreen) 
			{
				docElm.webkitRequestFullScreen();
			}
		




Exit/Cancel The Full Screen

If you want to exit the full screen mode, it is also a method to close the full screen and return back to the normal mode.

		if (document.exitFullscreen)
						{
							document.exitFullscreen();
						}
						else if (document.mozCancelFullScreen)
						{
							document.mozCancelFullScreen();
						}
						else if (document.webkitCancelFullScreen) 
						{
							document.webkitCancelFullScreen();
						}
						else if (document.msExitFullscreen)
						{
							document.msExitFullscreen();
						}
		




FULL CODE

		
		
        
        Fullscreen API- prittytimes.com   
		
		
        

Fullscreen API in prittytimes.com

A demo of the Fullscreen API




This great features are used for image slideshows, you can make the browser go into full screen on a click of an image.

Leave a Reply

Your email address will not be published. Required fields are marked *