BenM
BenM

Reputation: 53198

Force full screen in Chrome

I am currently working on a private web application that is not going to be released to the public. It is relatively straightforward and will run on Google Chrome.

Does anyone have a solution for forcing the browser to enter Full Screen Mode when the DOM is ready? I was thinking to simply simulate the keypress of the F11 key, but I don't know if this is possible.

Does anyone have a jQuery solution, other than resizing the window to the available width and hiding the navigation (not an ideal solution).

Upvotes: 9

Views: 21144

Answers (5)

PeeHaa
PeeHaa

Reputation: 72652

As stated by others this isn't possible for obvious reasons already mentioned.

Although since it is a local site why don't you just create a Chrome shortcut for it in fullscreen:

Create a shortcut to Chrome:

"C:\Users\techiecorner\AppData\Local\Google\Chrome\Application\chrome.exe" --kiosk http://www.example.com

http://www.techiecorner.com/1941/how-to-auto-start-chrome-in-full-screen-mode-f11-everytime/

UDPATE

By now (HTML5) there is a proposal for a full screen API. To use this you could do something like:

// feature detection
if (typeof document.cancelFullScreen != 'undefined' && document.fullScreenEnabled === true) {
  // mozilla proposal
  element.requestFullScreen();
  document.cancelFullScreen(); 

  // Webkit (works in Safari and Chrome Canary)
  element.webkitRequestFullScreen(); 
  document.webkitCancelFullScreen(); 

  // Firefox (works in nightly)
  element.mozRequestFullScreen();
  document.mozCancelFullScreen(); 

  // W3C Proposal
  element.requestFullscreen();
  document.exitFullscreen();
}

For more information see the official specs.

Upvotes: 18

Frank
Frank

Reputation: 1056

This is a little late, but this gives you some experimental access to full screen aps. You can simulate a click event and get it to fire.

https://github.com/martinaglv/jQuery-FullScreen

A jQuery 1.7 plugin that wraps around the Full Screen API and works around various browser differences. Works in FF 10, Chrome and Safari. It is useful for presenting users with an easier to read version of your web pages, or zooming and elements.

Upvotes: 0

Ray K
Ray K

Reputation: 1490

This is a no-can-do since you are trying to manipulate the actual program running on the OS. You can manipulate anything within the browser window, but not outside.

Upvotes: 0

Roman
Roman

Reputation: 6408

I doubt it is possible (not considering browser extensions).

Browsers generally don't allow such kind of access to their window. Actually, modern browsers don't even allow you to change the size of the current window (only if it's a popup).

If it's crucial to your application, you should display a message to the user informing him to press F11 when the browser is not in fullscreen mode.

Upvotes: 0

Pepijn
Pepijn

Reputation: 4253

This is most likely not possible, I would consider this a security threat if it was.

If you have control over the environment, you could accomplish this with AppleScript on Mac. Not sure about Windows.

Upvotes: 0

Related Questions