x


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...

more ▼

asked Aug 24 '11 at 06:43 AM

yosh gravatar image

yosh
901 73 81 94

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. "

Aug 24 '11 at 09:23 AM tomekkie2

Possibly you could try to do fullbrowser through manipulating the embedding javascript on the web page.

Aug 24 '11 at 09:42 AM tomekkie2

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..

Aug 24 '11 at 11:02 AM yosh

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.

Aug 24 '11 at 11:41 AM Bunny83

Thanks for your infomation...

Aug 24 '11 at 12:50 PM yosh
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Aug 24 '11 at 12:55 PM

BerggreenDK gravatar image

BerggreenDK
2.4k 54 62 75

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x85
x72
x53

asked: Aug 24 '11 at 06:43 AM

Seen: 1613 times

Last Updated: Aug 24 '11 at 12:55 PM