skip to Main Content

I published my app online to test it. On a computer it works well but on mobile everything is really small.
I can reproduce this bug by using the DevTools and the responsive mode. There is no bug locally but only on the linux server. I simply published the project in Visual Studio and copy the files on the server (CentOS-7, Apache/2.4.6) (had the same bug on Debian). I also added a blazorapp.conf configuration file in /etc/httpd/conf.d:

<VirtualHost *:80>
    ServerName my.website.com

    DocumentRoot "/var/www/blazorapp"
    ErrorDocument 404 /index.html

    AddType application/wasm .wasm
    AddType application/octet-stream .dll

    <Directory "/var/www/blazorapp">
        Options -Indexes
        AllowOverride None
    </Directory>

    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE application/octet-stream
        AddOutputFilterByType DEFLATE application/wasm
        <IfModule mod_setenvif.c>
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4.0[678] no-gzip
      BrowserMatch bMSIE !no-gzip !gzip-only-text/html
  </IfModule>
    </IfModule>

    ErrorLog /var/log/httpd/blazorapp-error.log
    CustomLog /var/log/httpd/blazorapp-access.log common
</VirtualHost>

Here is how it should be:

enter image description here

And how it is with the mobile version:

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found the problem. My website was on a private server and the external port wasn't on port 80 or 443. The mobile device uses then the computer view instead of the mobile view (for security?). Maybe someone can give a clearer answer then me (don't know much about netwerk).


  2. This is most likely a header issue. In the <head> section of your page, you will need something like:

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    I’m a little surprised that it’s not already set, as I’m pretty sure the default Blazor project includes this.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search