File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Features in HTML5 that might help a better mobile web pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Features in HTML5 that might help a better mobile web pages" Watch "Features in HTML5 that might help a better mobile web pages" New topic
Author

Features in HTML5 that might help a better mobile web pages

Jagadeesh Balasubramanian
Greenhorn

Joined: Oct 30, 2007
Posts: 13
With ever growing mobile web space, what all features in HTML5 you see will be good help in mobile web development?
Eric Freeman
author
Ranch Hand

Joined: Jun 21, 2004
Posts: 33
    
    5
For starters the geolocation API, along with local storage and offline support. Beth will probably have some comments on the CSS side.

Eric

Co-Author of Head First Design Patterns
Elisabeth Robson
author
Ranch Hand

Joined: May 14, 2004
Posts: 173
    
    6
Well a key new feature of HTML is the media query. This is something you can add to HTML through the link element, using the media attribute, or to CSS using the @media selector. For instance, you can write:

<link media="only screen and (max-device-width: 480px)" href="mobile.css" rel="stylesheet">

and the file mobile.css will only be loaded if the user is on a device with a maximum screen width of 480px.

It's also a good idea to use the viewport meta tag. For instance, if you do this:

<meta name="viewport" content="width=device-width">

the mobile browser will automatically size the page for the device width.

These aren't really "HTML5" specific things, but new additions to the link and meta tags.

In addition to these, browser makers are working on adding support for touch events and orientation changes in JavaScript. So just like you can add a handler for a click event, you can add a handler for an orientation change event. A tap is equivalent to a click, but, for instance, Apple has also added support for "gesture" events. Again, this isn't really an HTML5 thing, but a new feature that may be specific to the browser maker. There is a W3 standard in development for Touch Events, but it's not clear that all the browser makers have signed on to it (and indeed there may be some patent issues that will cause problems with this, unfortunately!).

Elisabeth

Co-Author of Head First JavaScript Programming
Elisabeth Robson
author
Ranch Hand

Joined: May 14, 2004
Posts: 173
    
    6
Oh, I should also add that the W3C (primarily driven by Mozilla) is working on a Device APIs specification, that would add JavaScript APIs to support things like phone calls, vibration, access to device contacts and other device apps, in order to support an HTML5-only phone interface! Which is pretty cool... a long ways off though, but coming!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Features in HTML5 that might help a better mobile web pages