Stories
Slash Boxes
Comments

SoylentNews is people

The Fine print: The following are owned by whoever posted them. We are not responsible for them in any way.

Journal by mcgrew

There are an awful lot of pages on my web site, and I've been busy making them all "mobile-friendly". Most of them are little or no problem making them look good on all platforms, but there are three that are especially problematic.

I jumped this hurdle (well, sort of stumbled past it) by making two of each of the pages with a link to the mobile page from the index.

Ideally, I could just check to see if it was a phone or not and redirect phones to the mobile page, but there's no way to make this 100% successful*. Each brand of phone has a different user agent, there are a lot of installable phone browsers. On top of that, is it an Android phone or an Android tablet? With the minimum typeface size and viewport set, those pages are fine on the PC version but the phone version looks like crap.

Apple should have thought of this when they made the first iPhone, and Google should have thought of this when developing Android. The answer is simple, but it can only be implimented by browser makers and perhaps the W3C.

From the beginning of the World Wide Web, browsers looked for index.html, the default front page in any directory. This worked fine before smart phones, but no longer.

Phone browsers should look first for mobile.html, and if it exists display that, and display index.html if it isn't there. Tablets and computers would behave as they always have.

It doesn't have to be mobile.html, it could be any name as long as everyone agreed that it was the standard, like they did with index.html.

Maintaining a web site would be much easier if they did this. What do you guys think?

* A fellow Soylent tipped me to the Apache Mobile Filter. It looks promising, especially since my host uses Apache. I'm looking into it.

Display Options Threshold/Breakthrough Reply to Article Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Informative) by fliptop on Thursday May 14 2015, @07:54PM

    by fliptop (1666) on Thursday May 14 2015, @07:54PM (#183089) Journal

    If you get AMF implemented, in your conf file:

    <Files index.shtml>
      PerlInitHandler Your::Namespace::IsMobile
    </Files>

    and then use mod_perl. This will redirect if it's a phone, but not if it's a tablet:

    package Your::Namespace::IsMobile;
    use strict;
    use Apache2::Const qw{ REDIRECT DECLINED };

    sub handler {
       my $r = shift;
       my $uri = $r->uri;

       if (($r->subprocess_env('AMF_DEVICE_IS_MOBILE') eq 'true' &&
       $r->subprocess_env('AMF_DEVICE_IS_TABLET') eq 'false' &&
       $uri =~ /^\/index\.shtml/g) {
         $r->subprocess_env(USE_MOBILE_SITE => 1); # set an env var to use later, if desired
         $r->headers_out->set(Location => "http://whatever.com/mobile.shtml");
         return Apache2::Const::REDIRECT;
       }

       return Apache2::Const::DECLINED;
    }

    1;

    __END__

    --
    To be oneself, and unafraid whether right or wrong, is more admirable than the easy cowardice of surrender to conformity
  • (Score: 2) by kaszz on Friday May 15 2015, @03:58PM

    by kaszz (4211) on Friday May 15 2015, @03:58PM (#183380) Journal

    The problem is that web pages tries to decide how the content should be displayed instead of delivering content and letting the browser decide how to display that.

    Thought failings can't be fixed with no amount of programming. It's like solving the problem of driving over the cliff edge by attaching a turbo jet motor. It will only drive you faster over the edge.

    • (Score: 2) by mcgrew on Sunday May 17 2015, @03:25PM

      by mcgrew (701) <publish@mcgrewbooks.com> on Sunday May 17 2015, @03:25PM (#184072) Homepage Journal

      What you say is true; I've been railing about people using absolute values rather than percentages for years, but it's a lot harder with phones. Regular web pages look fine on a tablet but just don't work on a phone. Phone browsers are crappy; one shouldn't have to specify a viewport, for example. width=device-width, initial-scale=1.0 should be the default, especially for phones. If you don't specify that and a minimum height for text (which should also default) a phone will have a line of tiny text with most of the screen as whitespace. Tap the screen and it magnifies, so the whole thing is white until you sideways scroll to the content, which then fits the page. This is insane.

      It's the phones themselves that require you to decide how the content is displayed.

      --
      Carbon, The only element in the known universe to ever gain sentience