View Single Post
Old 08-04-2005, 04:56 PM   #2
Chaos
Evangelist
Chaos has a complete set of Star Wars action figures.Chaos has a complete set of Star Wars action figures.Chaos has a complete set of Star Wars action figures.
 
Posts: 418
Karma: 281
Join Date: Jul 2004
Location: Canada
Device: Assorted older devices
You like using that C-series Zaurus image for mobile web things, don't you?


The most efficient design for mobile websites is to use, mainly, CSS for layouts. A large CSS file, a small actual HTML file. Bunch of small <div> and <span> tags, which are empty HTML elements for those who don't know, and define how/where they appear in CSS.

As I said in another post, many handheld browsers don't support the handheld media type, which means you have to jump through some hoops for easy mobile support.

The best way I've found is to use the handheld media type where possible, but also add a way for the stylesheet to be switched by an if statement. Using sessions makes this partly saved, and using cookies would make it entirely save-able. And for convenience, one can have a "mobile.php" or similar file, that defines the session variable, and then redirects to the index page.

That's sort of 'mobile.php' is only a few lines of code. For example:
PHP Code:
<?php
session_start
();
$_SESSION['mobile'] = 1;
header("Location: index.php");
?>
I dunno, that's just the way I've figured out to get around the serious deficiencies in mobile browsers. Unfortunately it still loads images, without displaying them, as I also noted in that post, even if img { display: none !important;} is in the CSS... At least that's the way browsers I've tested behave...

You could theoretically use user agent detection, but I'm personally wary of using user agents for anything like that - what happens if/when you run into a new mobile browser? You'd have to add it's user agent to the 'check list'... And user agents *aren't* the most reliable things ever...
Chaos is offline   Reply With Quote