I had an issue with my project deploying for webgl. Basically all monitors are different and I want the game to be consistent for everyone playing. I set my resolution to deploy in a certain resolution, but the fullscreen button that is default with the webgl template/loader just makes the game fullscreen for whatever monitor and resolution you have. For the most part my game doesn’t change much but there are still some aspects that don’t work like they should if in the original resolution. Since this seems kind of buggy reading through the forums, is there a way to remove the fullscreen button entirely? so I can just avoid this issue for now. Thanks
go in C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\WebGLTemplates
here you will see all your template
copy and paste the default folder and name it default no full screen
this will add a new template into your unity editor
then go in your new folder, then edit index.html and remove the line with the div class=“fullscreen”
then go in the template data folder and remove the fullscreen.png
you will now have a new template in your unity with no fullscreen and the loadingbar
To fix this issue, I changed the default template in ‘player settings’ to just the blank white one. I don’t have a loading bar now but the fullscreen button is gone.
I could probably find a custom template that will have a loading bar and not have the fullscreen option, just haven’t looked yet.
It doesn’t work anymore. Are there current options?
I was able to stop the Unity WebGL fullscreen default action for my Unity 2019.1.3 project by editing the UnityLoader.js file found in the “Build” directory created when you make a build.
I removed “(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf(“Safari”)==-1||s>=10.1)?1:0” from the “hasFullscreen:function()”.
B E F O R E :
hasFullscreen:function(){var e=document.createElement(“canvas”);return(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf(“Safari”)==-1||s>=10.1)?1:0}
A F T E R :
hasFullscreen:function(){var e=document.createElement(“canvas”);return}
I have not thoroughly tested this yet on all browsers, but so far it has stopped the “dreaded FullScreen attack” when viewing my WebGL build in Chrome, firefox, Vivaldi and Safari browsers.
Clearly this is a hack… lol… your mileage may vary.