views:

182

answers:

4

I want a browser to go full screen as soon as my page loads. Is it possible in javascript. I know the shortcut key for this F11 but requirement is on page load only.

After reading the solution provided below. I achieved full screen but here i got a trap. I was using timer to make my page postback to get fresh data after every 5 second. And here I found after every 5 sec new window opens up but I want full screen to go only once and next time content gets refreshed there itself.

+1  A: 
function OpenfullScreen(URL) {
    window.open(URL, '', 'fullscreen=yes, scrollbars=auto');
}

call this function from where you are opening the page

Bala
Is this even allowed and not blocked by the browser? Be cause I would harm anyone who whould do this without warning.
PoweRoy
@PowerRoy, it doesn't have the same effect as F11 though..
Filip Ekberg
+1  A: 

you can use the window.open('yourlocation.htm', 'New window name', 'fullscreen=1');

NOTE THAT fullscreen is ONLY supported in I.E. browser. Not recommended to use since it is browser dependent.

Function Specification

the format of window.open() is window.open (URL, windowName[, windowFeatures])

URL is the URL page you trying to open windowName is the name given to this window

Windowfeatures is the additional parameter you would like this window to have

  • status -status bar at the bottom of the window. e.g. "status=1"
  • toolbar -standard browser toolbar, with Back and Forward button etc. e.g. "toolbar=0" mean no toolbar location
  • Location entry field where you enter the URL. e.g. "location=0"
  • menubar -menu bar of the window e.g. "menubar=1"
  • directories -The standard browser directory buttons e.g. "directories=1"
  • resizable -Allow/Disallow the user to resize the window. e.g. "resizble=0"
  • scrollbars -Enable the scrollbars if the document is bigger than the window e.g. "scrollbars=1"
  • height -Specifies the height of the window in pixels
  • width -Specifies the width of the window in pixels.
calculus1985
A: 

you can use <meta http-equiv="refresh" content="5" /> to refresh the browser in every 5 seconds.

place this code in the new window instead of the one that call it

calculus1985