What determines the viewport (initial-scale) of a .txt document on mobile browsers? What determines the viewport (initial-scale) of a .txt document on mobile browsers? google-chrome google-chrome

What determines the viewport (initial-scale) of a .txt document on mobile browsers?


No, there is nothing that tells the browser how to display documents such as plain text files.

For some reason Chrome (mobile) zooms only .txt files with more than 302 characters.This seems to be true for other webkit browsers too.

Gmail's robots.txt is 128 characters long and Chrome doesn't zoom it.

Here are two almost identical files, in the same folder; the only difference is the number of characters stored.

301 characters long .txt file: http://tonttest.altervista.org/301byte.txtscreenshot of 301 character long .txt file on Chrome mobile

302 characters long .txt file: http://tonttest.altervista.org/302byte.txtscreenshot of 302 character long .txt file on Chrome mobile


Not a complete answer, but I don't think it should be a comment either.

Some testing indicate that it's not related to HTTP headers but related to a zoom formula which uses character count and viewport width. Formula could probably be derived from here. But I'm not up to that task.

A few findings about this "formula":

  • Shows visible effect only when viewport width <= 980
  • Starts working when character count < 302
  • Firefox doesn't care about it.

I'm guessing this is actually a standard and Firefox didn't implement it because it's not that important. But I could be wrong, and it could be a non-standard Chrome thing.


also, in html from personal experience i know that when programming or coding a website, you have to put more effort into actually coding it to make it fit nicely to a mobile screen and/or a computer screen/monitor. a quick google search would help you with that too.

in your case, it's possible that google didn't bother to put forth the effort into styling that page so that its more easily viewable on mobile devices, and figured that people aren't typically going to be going to that text file on the gmail website. and they may have also figured that if someone did want to or need to view it, they'd be doing something such as, but not limited to programming or coding.and stack overflow decided to because its a website revolving around coding and programming.

hope this helps!