Unity is best tool for its support for multiple platforms. But in WebGL for android it creates some exception warning.
When you run WebGL project on website. It works fine but when you open it on Mobile device it shows a warning Message.
“Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway. OK”
This is a warning message embedded in your code by unity. If you want to remove this warning message from your app then you have to remove this exception check code from your unity loader file.
So Lets Test this Example.
When you build your project in WebGL, a complete folder is created having multiple files in it.
Basically two folders and an index file, Something like this.
Now you have to find unityLoader.JS file. It is inside Build folder.
Now open this “UnityLoader” file in any text editor. I am gonna open it in Notepad++.
Select all code and copy it. // [Select all(Ctrl + A) Copy (Ctrl+ C)]
Paste all your “UnityLoader”code into this section.
Now click on “Beautify code“ button. All of your code will be beautified.
Now copy all this code and paste it back to your UnityLoader.JS file.
Code is completely beautified. Now you have to remove “exception check” from the code.
Now search for the error code. To search error code press “Ctrl+F”. A new dialog box will open and type your error message in to it. “Please note that Unity WebGL”
Now finally you fond your error exception function.
Remove all the code from the function body of compatibility check. And type “t( );” in it.
Save your file and you are done with it.
Run your index file . You will not receive this exception again.
Hope this tutorial will help you a lot. If you feel any type of problem feel free to ask in comment section below.