On Thu, Aug 19, 2010 at 11:52 AM, 49342) <mah(a)everybody.org> wrote:
Why is the mobile redirect left to Javascript?
Wouldn't it be better
for all concerned if the redirect happened before any PHP was loaded?
Wouldn't it be better for those older phones with little memory if the
redirect happened in PHP?
Forget memory -- the extra network and processing time involved in fetching
an extra complete HTML+CSS+JS version of the page, then throwing it away and
fetching another one, is wasteful and annoying even on highly capable
phones!
However, we can't just use a User-Agent check in PHP for this, since
90-something percent of the time the PHP scripts are not being executed: the
Squid caches respond to most web requests directly.
So what would be required would be some filtering in the caches to check for
particular User-Agents or other settings and send them the redirect
directly, or send them through to PHP for possible redirection. (Assuming
there's no problem with downstream caching, which I think should usually be
ok the way we have things marked -- as long as the redirect responses are
marked as private-cache or uncacheable.)
A JavaScript hack was quicker to put in place than the cache-level logic,
but it was only ever meant as a stopgap.
-- brion vibber (brion @
pobox.com)