Search Unity

Question MIME - WebGL

Discussion in 'Web' started by MatrixNew, Dec 15, 2023.

  1. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    80
    Hi guys!
    When I launch the game in the browser, I get an error in the browser console, but the game is running. The error is this:
    In the htaccess file I have the following settings:

    Configured MIME types on the server:


    How to fix the (MIME type) error?
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,749
    You havent set the content type - that looks like the older style of setup for webgl :(

    heres mine

    Code (Boo):
    1. AddType application/x-httpd-php53 php
    2. AddType application/wasm wasm
    3. AddType application/wasm wasm.gz
    4. AddType application/wasm wasm.br
    5. AddType application/javascript js
    6. AddType application/javascript js.br
    7. AddType application/javascript js.gz
    8.  
    9. # The following line improves loading performance for uncompressed builds
    10. AddType application/wasm .wasm
    11. AddEncoding gzip .unityweb
    12.  
    13. <IfModule mod_mime.c>
    14.  
    15. <FilesMatch "[^.]+\.unityweb$">
    16.   Header set Content-Encoding "gzip"
    17. </FilesMatch>
    18.  
    19. <FilesMatch "[^.]+\.gz$">
    20.   Header set Content-Type "application/gzip"
    21.   Header set Content-Encoding "gzip"
    22. </FilesMatch>
    23.  
    24. <FilesMatch "[^.]+\.data\.gz$">
    25.   Header set Content-Type "application/octet-stream"
    26.   Header set Content-Encoding "gzip"
    27. </FilesMatch>
    28. <FilesMatch "[^.]+\.js\.gz$">
    29.   Header set Content-Type "application/javascript"
    30.   Header set Content-Encoding "gzip"
    31. </FilesMatch>
    32. <FilesMatch "[^.]+\.wasm\.gz$">
    33.   Header set Content-Type "application/wasm"
    34.   Header set Content-Encoding "gzip"
    35. </FilesMatch>
    36. <FilesMatch "[^.]+\.wasm$">
    37.   Header set Content-Encoding "gzip"
    38.   Header set Content-Type "application/wasm"
    39. </FilesMatch>
    40.  
    41. <FilesMatch "[^.]+\.data\.br$">
    42.   Header set Content-Type "application/octet-stream"
    43.   Header set Content-Encoding "br"
    44. </FilesMatch>
    45. <FilesMatch "[^.]+\.js\.br$">
    46.   Header set Content-Type "application/javascript"
    47.   Header set Content-Encoding "br"
    48. </FilesMatch>
    49. <FilesMatch "[^.]+\.wasm\.br$">
    50.   Header set Content-Type "application/wasm"
    51.   Header set Content-Encoding "br"
    52. </FilesMatch>
    53.  
    54.  
    55. </IfModule>
     
  3. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    80

    Code (CSharp):
    1. AddType application/x-httpd-php53 php
    If you remove this line, everything works fine!

    Thank you very much buddy!!!
     
  4. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,749
    I did say it was mine :D that was something i needed :D
     
  5. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    80
    Can this error be fixed or is it no longer due to the server?

     
  6. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,749
    no idea, note related to mime types though. TBH I dont get those
     
  7. AbeSmitham

    AbeSmitham

    Joined:
    Jan 11, 2024
    Posts:
    1
    I have a doubt, should I ask it here?
     
  8. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,749
    Depends what it is, is it relevant to this thread?
     
  9. AdanPrice

    AdanPrice

    Joined:
    Jan 12, 2024
    Posts:
    1
    Any update?

    Edit: Seems no
     
    Last edited: Jan 24, 2024