Javascript: automatically increase browser window and switch to full screen mode?

I am working on a flash application with a size of 900x700 pixels. When viewing in different ways. browsers with a resolution of 1024x768, the Chrome browser creates too much vertical space, and the application appears in a window with a vertical scroll bar. Unacceptably.

The Flash application will be launched via a link sent by email to viewers.

I would like to avoid resizing the flash application, and I wonder if there is a way to do the following through javascript without clicks:

  • enlarge the current browser window
  • delete the current address bar of the window and the tabs / switch the browser to full screen mode (equivalent to pressing F11).

An alternative would be to resize the flash application vertically according to the height of the browser canvas to avoid scrolling. This can cause the application to become unreadable, so it’s not the best approach in my case.

Thanks!

UPDATE: It seems that resizing the browser and auto power off in full screen mode will not work, and none of them will be automatically resized. What is the best approach? 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 before pres F11 manually. The audience is executing, and some may not even know what F11 means ...

+2
source share
5 answers

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

stage.displayState = StageDisplayState.FULL_SCREEN; 
+1
source

It is not possible to maximize the browser window in full screen using JavaScript. While this is unfortunate for your true claim, it is considered a security constraint.

Sources:

+4
source

Window size can be changed using:

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

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

+1
source

Chrome 15, Firefox 10, and Safari 5.1 now provide an API for programmatically launching full-screen mode. The full-screen mode triggered in this way provides events for detecting full-screen changes and CSS pseudo-classes for styling full-screen elements. These APIs may provide you with a more acceptable solution for these browsers.

See this hacks.mozilla.org blog post for more details .

+1
source

Source: https://habr.com/ru/post/1344401/


All Articles