summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-05-18 14:22:25 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-05-18 14:22:25 +0000
commitd78ffe229869321c11d95290e163b213f8de7b25 (patch)
treea9b0461de545370ecb5b92657e20e8f0f3df2061 /usr.bin/mandoc
parentbdcba9831aa2bd37c0552fda2ceb4e46b2123ac8 (diff)
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@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/cgi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index d6cfc87244d..abc3d3a92b4 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgi.c,v 1.94 2017/06/24 14:38:27 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.95 2018/05/18 14:22:24 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de>
@@ -352,6 +352,8 @@ resp_begin_html(int code, const char *msg, const char *file)
"<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>",