Javascript: Automatically maximize browser window and switch to full screen mode?

I am working on a Flash app that is 900x700 pixels. When viewed in misc. browsers at 1024x768, the browser chrome causes robs too much of the vertical space and the app appears in a window with a vertical scrollbar. Unacceptable.

The flash app will be launched via a link emailed to the viewers.

I'd like to avoid resizing the flash app and am wondering if there's a way to do the following via javascript, with no clicks involved:

  1. maximize the current browser window
  2. remove current window address bar and tabs / switch browser to full screen view (equivalent to pressing F11).

An alternative would be to resize the flash app vertically to match the browser canvas height to avoid scrolling. This may cause the app to become unreadable, so not the best approach in my case.

Thank you!

UPDATE: Seems that browser resizing and autoswitch to full screen won't work and neither will the flash app auto resize. What is the best approach then? And, some users may have browsers with toolbars or open a small browser window.

The only idea I have is to use javascript and display a message to users with small browser windows to pres F11 manually. The audience is executes and some may not even know what an F11 means...



To answer the question in the comment you made to your own post. Yes. You can have a button whose click handler does this

stage.displayState = StageDisplayState.FULL_SCREEN;

There is no way to maximize the browser window to full screen with JavaScript. While this is unfortunate for your genuine requirement, it is considered a security restriction.



The window size can be altered by using:

window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);

You can use JavaScript to open a new window (using and control the window that is opened (no address bar, etc). You can also control the size of the window (you can't maximize it, but you can get the users screen size, and set the window that same size).


Chrome 15, Firefox 10, and Safari 5.1 now provide APIs to programmatically trigger fullscreen mode. Fullscreen mode triggered this way provide events to detect fullscreen changes and CSS pseudo-classes for styling fullscreen elements. These APIs may present you with a more acceptable solution for those browsers.

See this blog post for details.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.