Marc Espie wrote on Wed, May 16, 2018 at 11:28:31AM +0200:
> On Tue, May 15, 2018 at 10:51:43PM +0200, Ingo Schwarze wrote:
>> x...@dr.com wrote on Tue, May 15, 2018 at 07:47:45PM +0200:

>>> The "viewport" meta tag significantly improves readability and 
>>> usability on my phone when I add it to http://man.openbsd.org pages:
>>> [meta name="viewport" content="width=device-width, initial-scale=1.0"]

>> There is no way i will use that.
>> It is not defined in any standard.

> As someone pointed it out, it is in a proposal, improves things on
> several devices, and is harmless on others.
> 
> You quite well know that the web evolves by practice first, and 
> standardization later.
> 
> We are talking about something that's currently already written, will
> likely become a standard in some months, and helps using tools.
> 
> Why resist ?

Actually, the proposed standard is for something else:
CSS "@viewport { width: auto; }"  as opposed to
HTML <meta name="viewport" content="blabla">,
and almost no browser implements the proposed standard.
The proposed standard merely explains how to migrate from
the non-standard meta tag to the @viewport rule.

That said, i did not even consider the possibility that for
such a basic necessity, no standard exists, nor the possibility
that default behaviour is nearly universally broken.  But that's
how it is, apparently...

So i think i was wrong and espie@ and xcv@ were right: With broken
and/or inscrutable default behaviour being almost universal and in
the absence of standards, there is no alternative to using whatever
actually works.  Also, my remarks about minor tweaks were not quite
to the point because unreadable text on a whole class of devices
is not a minor issue.  It is still possible to resist minor tweaks
once we have readable text...

For technical details, see the commit message below.

I'm still open for better solutions, ideally with CSS standardized
long ago such that it is widely available.  Also, i'm still interested
in understanding what exactly in mandoc.css causes mobile browsers
to set the viewport width to 1000px by default, but i have no chance
to test myself because i have no mobile device.  Apparently, the
max-width attribute on the html element isn't the reason because
removing it only removed, well, the max-width, but did not change
the viewport width according to xcv@'s testing.

Yours,
  Ingo


Log Message:
-----------
In a nutshell, all mobile browsers are broken.
By default, no matter the physical screen size, they use a fixed
viewport width of about 1000px, then scale down the rendered page
to make that huge viewport fit on the physical screen.
That results in poor rendering for bad websites which assume a
large fixed-size viewport (typically requiring zooming in to be able
to actually read any text), but in atrocious rendering for good
websites that make no assumption about the screen size (unreadably
small text in the top left corner, most of the screen empty).

A standard way to disable that insane behaviour and just render
normally on the actual physical screen size does not exist.
The closest thing is the CSS3 Device Adaptation Module Level 1
https://drafts.csswg.org/css-device-adapt/
but https://caniuse.com/#feat=css-deviceadaptation tells me
that basically no browser implements it, not even on mobile.

The next closest thing is the HTML meta viewport element - even though
the problem has nothing to do with HTML and is purely a CSS issue.
Standardization is not even planned for that one:
* HTML 5.2 mentions it in passing without specifying it:
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
* The Web Hypertext Application Technology Working Group
provides very incomplete information:
https://wiki.whatwg.org/wiki/MetaExtensions
* CSS3 Device Adaptation Module Level 1 already wants to deprecate it,
explaining mostly how to migrate *away* from it to some castle in
the sky that no browser implements:
https://drafts.csswg.org/css-device-adapt/#viewport-meta

While i strongly believe in sticking to well-established standards,
in the absence of standards and with atrocious behaviour being
universal, there appears to be no alternative to using whatever
works.  The meta viewport element appears to be the only way to
make real-world mobile browsers decently render any HTML page that
does not have a fixed-width layout of 1000px.  So use it, grudgingly.

Originally suggested by xcv at dr dot com.
Direction supported by espie@.

Modified Files:
--------------
    mandoc:
        cgi.c

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/cgi.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -Lcgi.c -Lcgi.c -u -p -r1.156 -r1.157
--- cgi.c
+++ cgi.c
@@ -356,6 +356,8 @@ resp_begin_html(int code, const char *ms
               "<html>\n"
               "<head>\n"
               "  <meta charset=\"UTF-8\"/>\n"
+              "  <meta name=\"viewport\""
+                     " content=\"width=device-width, initial-scale=1.0\">\n"
               "  <link rel=\"stylesheet\" href=\"%s/mandoc.css\""
               " type=\"text/css\" media=\"all\">\n"
               "  <title>",

Reply via email to