Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Uploaded WebGL not loading on Firefox

Discussion in 'WebGL' started by BenJones, Oct 21, 2015.

  1. BenJones

    BenJones

    Joined:
    Dec 14, 2012
    Posts:
    11
    I've been stumbling through getting WebGL to load the compressed files, and I think I got it working in Chrome, but Firefox has stopped loading the WebGL player. Can someone tell me what I'm doing wrong?

    Here it is (the giant red thing is me testing stuff):
    http://getinspir3d.com/inspir3d-viewer2/index.html

    And here is all my info:

    Unity Version: 5.1.0f2

    WebGL Player Settings:


    I tested it with the profiler and I am using about 170mb max, so 256mb should be fine.

    htaccess file (standard generated one):
    Code (CSharp):
    1. Options +FollowSymLinks
    2. RewriteEngine on
    3.  
    4. RewriteCond %{HTTP:Accept-encoding} gzip
    5. RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz [L]
    6. RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz [L]
    7. RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz [L]
    8. RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
    9. AddEncoding gzip .jsgz
    10. AddEncoding gzip .datagz
    11. AddEncoding gzip .memgz
    12. AddEncoding gzip .unity3dgz
    Web Host: siteground.com
    Plan: Startup Account: https://www.siteground.com/web-hosting.htm

    inside cPanel I added the file extensions unity WebGL uses for the gzipped files:


    I wasn't sure if I needed the dot in the extension (.jsgz vs jsgz) so I added both versions as application/octet-stream

    I also enabled "Optimize Website" to compress application/octet-stream in cPanel (not sure if I needed to or not):





    It works fine locally on Firefox, but when its uploaded I get a "SyntaxError: illegal character" coming from the javascript files. When I click on the link to check out where the error is coming from all I see is a bunch of symbols:

    Any help would be much appreciated. I am kind of new to WebGL and haven't found many tutorials on how to set up WebGL with a web host and get the compressed files to load.

    Thanks!
    -Ben
     
  2. BenJones

    BenJones

    Joined:
    Dec 14, 2012
    Posts:
    11
    So I'm not sure exactly what I did but the Gzip compression is working on newer builds. Maybe it just took a little while for my webhost to update on their end? I am running into a new problem, pretty sure it's unrelated to this topic.
     
  3. Assembly4D

    Assembly4D

    Joined:
    Nov 21, 2015
    Posts:
    3
    Hi BenJones. Did you ever figure out what was causing the illegal character error? I can't get my webGL builds to run in anything other than Chrome. Your demo works in all browsers for me. Thanks!
     
  4. Moonmanjimd

    Moonmanjimd

    Joined:
    Dec 19, 2014
    Posts:
    7
  5. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    @Moonmanjimd : Can you check if your Firefox supports WebGL, by going to https://get.webgl.org ?

    (If you see a spinning cube, WebGL is supported, otherwise not).