- Home /
Webplayer: Switch to fullscreen via HTML-Button?
Hi,
any known workarounds so i can switch the unity content to fullscreen when i press a HTML Button? When i pressed, i want to call a javascript function that communicates via "GetUnity.SendMessage("GameObject, "StringHTML", "test");
In that "StringHTML"-function there´s my fullscreen switch function: Screen.SetResolution(1024, 768, true);
When i call this function from a unity gui button, the screen switches to fullscreen. When press the html-button, any guitext in the unity content gets updated but the "SetResolution" doesn´t switch to fullscreen.
Any ideas how to force that? Thanks for your time...
Have you seen, what the docs say? http://unity3d.com/support/documentation/ScriptReference/Screen.SetResolution.html
"In the web player you may only switch resolutions after the user has clicked on the content. The recommended way of doing it is to switch resolutions only when the user clicks on a designated button. "
Possibly you could try to do fullbrowser through manipulating the embedding javascript on the web page.
Hey tomekkie2, yeah i´ve read that. Therefore i asked for "workarounds" ;) I´ve tested to manipulate the unitycontent div via jquery but with no success..
I guess it's not possible because a website should not be able to put you in fullscreen mode when the Unity content isn't focused.
Otherwise it could switch you into fullscreen even when the website is in a hidden tab. That would be a real pain and heaven for advert-creators.
Answer by BerggreenDK · Aug 24, 2011 at 12:55 PM
I think its a security issue, because if the browser could spawn the fullscreen, then someone could use this to fake another screen/interface when you open the website.
So my answer would be "no, you shouldnt be able to go into fullscreen from HTML/embedded javascript on a webpage"
The same thing goes for Flash which also has a fullscreen mode. I believe this was made a standard among browser developers to ensure that noone could fake a bank or transaction using some browser plugin.
I believe this also is why every fullscreen can be exited pressing ESC.
Your answer
![](https://koobas.hobune.stream/wayback/20220612191020im_/https://answers.unity.com/themes/thub/images/avi.jpg)