Mobile Web
The Mobile Web (also refered to as the Mobile Internet) is currently a minimized version of the current world wide web, however many have claimed that until the functionality and capabilities of the Mobile Web and the devices which access it improve, it may be relegated to a scarcely used version of the full Web.
Specifications
- Core Mobile Web Platform - 2012: http://coremob.github.com/coremob-2012/
- HTML5 for Mobile apps: http://www.whatwg.org/specs/web-apps/current-work/[1][2][3][4][5]
- MobileOK (xHTML Basic/MP): http://www.w3.org/TR/xhtml-basic/[6][7][8][9][10] (likely to be superceded by Mobile HTML5 initiatives)
- iMode (cHTML): http://www.w3.org/TR/1998/NOTE-compactHTML-19980209/[11][12] (becoming obsolete)
- WAP 1.1 technical specs (including WML): http://www.wapforum.org/what/technical_1_1.htm[13][14] (legacy/obsolete)
- Mobile Link Discovery spec: http://www.sixapart.jp/docs/tech/mobile_link_discovery_en.html (unofficial)
Approaches
META
Automatically set the page width to the device's physically available screen width/resolution:
<meta name="viewport" content="width=device-width" />
Disallow pinch/zoom (not a good move for accessibility reasons, but in the right context to maintain screen to content ratios for a particular experience):
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
CSS
Specify the media type to render mobile-specific styles:
<link type="text/css" rel="stylesheet" href="style/mobile.css" media="handheld" />
media Attribute
The CSS spec actually defines a number of device profiles, however, reliance on these as the only method of deciding device dimensions and presentation can be prone to errors as not all devices and browsers respect or follow the standards in this regard. Some may report the wrong profile or no profile at all.
Projector:
<link type="text/css" rel="stylesheet" href="css/projector.css" media="projection" />
Desktop:
<link type="text/css" rel="stylesheet" href="css/desktop.css" media="screen" />
Television:
<link type="text/css" rel="stylesheet" href="css/tv.css" media="tv" />
Mobile device (i.e. Smartphone, Cellphone, etc):
<link type="text/css" rel="stylesheet" href="css/mobile.css" media="handheld" />
Tablet:
<link type="text/css" rel="stylesheet" href="css/tablet.css" media="only screen and (min-width: 321px) and (max-width: 768px)" >
Printer and other print devices or software (such as a PDF converter, screenshot saver, etc):
<link type="text/css" rel="stylesheet" href="css/printer.css" media="print" />
@media Queries
You can also use the above technique of Media queries inline within <style> tags, or inside of an externally loaded CSS file itself:
@media handheld { .container { padding: 0; margin: 0; width: 100%; /* use % widths to prevent content overflows/resizes on mobile */ } .left { padding: 0; margin: 0; width: 20%; } .right { padding: 0; margin: 0; width: 80%; } }
Another useful trick is to be able to make an image or lengthy or secondary content section (i.e. within an ASIDE, DIV or P tag) appear only on orientation change:
.sidebar div { background:url(/img/huge.png) } @media only screen and (max-device-width: 480px) { .sidebar { display:none } } @media only screen and (max-device-width: 480px) and (orientation: landscape) { .sidebar { display:block } .sidebar div { background:url(/img/small.png) } }
Here's a full list of common queries for different screen resolutions and physical device sizes (organized in order of size, biggest to smallest).
Projectors such as in a home theater system, Work office presentation or board room, or Public Advertisement Display screens (expect HD, inability to read small text and changing dimensions => 2048x1536 and up, even iPad now has these specs with its retina display at 264 pixels per inch (ppi))[22]
TVs such as "Smartscreens", Google TV, Connected TVs, etc... (typically a widescreen with HD and retina display ==> 1920x1080)
Business, Hardcore Gaming or Developer Computers (usually use widescreen and/or dual screen display ==> 1680x1050)
@media only screen and (max-width: 959px) { }
Desktops and Laptops (most home PC & Mac users fall into this category ==> 1024x768)[23]
@media only screen and (max-width: 959px) { }
Desktops, Laptops or Netbooks with Smaller than standard 960 pixels wide ( ==> 800x600):
@media only screen and (max-width: 959px) { }
Tablet Portrait size to standard 960 (tablets and browsers ==> 800x1200):[24]
@media only screen and (min-width: 768px) and (max-width: 959px) { }
All Smartphone Mobile Sizes (typically only high-end smartphones approach this max-width ==> 640x480) and Tablet Landscape (lower-end portable devices and browsers ==> 600x1024):
@media only screen and (max-width: 767px) { }
Mobile Landscape Size (horizontal, left-to-right ==> 480x360) to Tablet Portrait (devices and browsers ==> 480x800):
@media only screen and (min-width: 480px) and (max-width: 767px) { }
Mobile Portrait Size (vertical, top-to-bottom ==> 1680x1050) to Mobile Landscape Size (devices and browsers ==> 320x240):
@media only screen and (max-width: 479px) { }
Legacy Mobile Phones, these old devices were believe it or not "phones" before they were portable entertainment centers or business tools and range widely in physical screen size, but typically only support video at 176x144:
@media only screen and (max-width: 320px) { }
User-Agent
User-Agent string matching or checking can be done to determine on the server-side (or client-side) whether the user is accessing your site via a Mobile Device or larger screened Desktop. This method is subject to abuse though as the User-Agent can be spoofed, hidden, missing (i.e. old device or stripped down) or just plain inaccurate, and should be considered unreliable. However, it can still be used for "suggested" redirecting or basic device/capability checking. Important variables include:
- navigator.userAgent
- navigator.appName
- navigator.appVersion
To list out all User-Agent related information, use the following:
for (i in navigator) { document.write('<br />navigator.' + i + ' = ' + navigator[i]); }
<?php $mobile_browser = '0'; if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { $mobile_browser++; } if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) { $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)); $mobile_agents = array( 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno', 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-', 'newt','noki','oper','palm','pana','pant','phil','play','port','prox', 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar', 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp', 'wapr','webc','winw','winw','xda ','xda-'); if (in_array($mobile_ua,$mobile_agents)) { $mobile_browser++; } if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini') > 0) { $mobile_browser++; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0) { $mobile_browser = 0; } if ($mobile_browser > 0) { // do something } else { // do something else } ?>
Responsive Design
Responsive Design uses a combination of methods (including )
- Off-Canvas Navigation for Responsive Book Menu: http://coding.smashingmagazine.com/2013/01/15/off-canvas-navigation-for-responsive-website/
Tools
- W3C - MobileOK validator: http://validator.w3.org/mobile/
- MobiReady: http://ready.mobi/ (check cost, render, load times of mobile web apps/pages) | EXAMPLE
- Mobile Emulators & Simulators: The Ultimate Guide: http://www.mobilexweb.com/emulators
- xHTML Basic 1.x - Mobile Emulator: http://mtld.mobi/emulator.php
- iPhone - Test iPhone: http://testiphone.com/[30]
- iPad - iPadPeek: http://ipadpeek.com/[31]
- WAP - WinWAP Smartphone Browser Emulator: http://www.winwap.com/desktop_applications/browser_emulator
- Mobile Phone Emulators: http://mobiforge.com/emulators/page/mobile-emulators
- DeviceAtlas - JS: http://deviceatlas.com/
- DetectMobileBrowsers PHP class: http://detectmobilebrowsers.mobi/
- 51Degrees - Mobile (automatic mobile version for ASP.net): http://51degrees.codeplex.com/
- JavaScript Engine speed benchmarks: http://arewefastyet.com/
Resources
- wikipedia: List of common resolutions
- W3C - Mobile Web: http://www.w3.org/Mobile/ (working group)
- HTML5 Mobile Development quick reference: http://cdn.dzone.com/sites/all/files/refcardz/rc186-010d-html5-mobile_0.pdf
- Adventures in Responsive Navigation: http://responsivenavigation.net
- Mobile Web API evolution: http://brendaneich.com/2012/02/mobile-web-api-evolution/[32]
- Mobile UI Patterns: http://mobile-patterns.com/
- Android Web Apps - developer guide: http://developer.android.com/guide/webapps/
- Mobile HTML5 development guide (by O'Reilly Media): http://htmlref.labs.oreilly.com/beta
- A Very Modern Mobile Switching Algorithm - Part II: http://mobiforge.com/designing/story/a-very-modern-mobile-switching-algorithm-part-ii
- Making Phone Calls and Sending SMS within HTML links: http://www.pointbeing.net/weblog/2010/01/making-phone-calls-and-sending-sms-with-html.html
- Detect Mobile Browser - Open source mobile phone detection code (User-Agent + RegEx based, many languages): http://detectmobilebrowser.com/
- Using JavaScript To Detect CSS Support: http://ifacethoughts.net/2008/03/15/using-javascript-to-detect-css-support/[33]
- Mobile Browser ID (User-Agent) Strings: http://www.zytrax.com/tech/web/mobile_ids.html
- Style sheet to transform XHTML 1.x in XHTML Basic 1.1: http://www.w3.org/2003/04/xhtml1ToBasic.xsl
- Best Mobile Web HTML5 Framework For Mobile App Development: http://dumaslab.com/2011/05/best-mobile-web-html5-framework-for-mobile-app-development/
- Nokia mobile web templates: http://www.developer.nokia.com/Develop/Web/Mobile_web_browsing/Web_templates/
- Mobile Learning Guide - Design Considerations: https://sites.google.com/a/adlnet.gov/mobile-learning-guide/design-considerations
- Mobile Web Design: http://www.hongkiat.com/blog/mobile-web-design/ (includes grid of most common device screen sizes)
- Mobile Website Vs Mobile Applications - Compare The Concepts: http://www.mconnectsolutions.com/blog/mobile-website-vs-mobile-applications-compare-the-concepts/
- Sencha Touch vs. JQuery Mobile: http://stvjqm.mobivant.com
Tutorials
- Global Authoring Practices for the Mobile Web: http://www.passani.it/gap/
- Mobile HTML5: http://www.mobilehtml5.com/post/371921120/tutorial-your-first-mobile-html5-app-the-basics
- Building a Mobile Website with PHP, MySQL and jQuery Mobile, Part 1: http://tutorialzine.com/2011/08/jquery-mobile-product-website/
- Everything you always wanted to know about Mobile Touch icons: http://mathiasbynens.be/notes/touch-icons
- Add a Mobile Landing Page to Your Site: http://buildinternet.com/2011/01/add-a-mobile-landing-page-to-your-site/
- Designing and Coding a Mobile Version of your Website: http://stever.ca/web-design/designing-and-coding-mobile-version-of-your-website/
- How to Design Websites for Mobile Phones: http://www.stemkoski.com/how-to-design-websites-for-mobile-phones/
- Fix your site's Mobile Profile: http://mobiforge.com/testing/story/fixit-xhtml-mobile-profile
- Standard way to detect mobile browsers in a web application based on the http request: http://stackoverflow.com/questions/142273/standard-way-to-detect-mobile-browsers-in-a-web-application-based-on-the-http-req
- Server-side capability detection for mobile devices part 1: http://dev.opera.com/articles/view/server-side-capability-detection-for-mob/
- Server-side capability detection for mobile devices part 2: http://dev.opera.com/articles/view/server-side-capability-detection-for-mob-1/
- How to serve the right content to mobile browsers: http://dev.opera.com/articles/view/how-to-serve-the-right-content-to-mobile/
- This End Up - Using Device Orientation & Device Motion: http://www.html5rocks.com/en/tutorials/device/orientation/
- Creating a Mobile Touch Slide Panel with JQuery: http://www.zackgrossbart.com/hackito/touchslider/
- The 5-Minute CSS Mobile Makeover: http://perishablepress.com/press/2009/08/02/the-5-minute-css-mobile-makeover/
- Return of the Mobile Stylesheet: http://www.alistapart.com/articles/return-of-the-mobile-stylesheet
- 10+ useful code snippets to develop iPhone friendly websites: http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites
- Is it possible to trigger onmouseover event on iPhone: http://stackoverflow.com/questions/2214398/is-it-possible-to-trigger-onmouseover-event-on-iphone
- Attempts at making a double click possible in CSS: http://css-tricks.com/examples/CSSDoubleClick/
- Creating a Mobile-First Responsive Web Design: http://www.html5rocks.com/en/mobile/responsivedesign/
- Device-Agnostic Approach To Responsive Web Design: http://coding.smashingmagazine.com/2012/03/22/device-agnostic-approach-to-responsive-web-design/1
- Responsive Image layout (for Mobile): http://filamentgroup.com/lab/responsive_images_experimenting_with_context_aware_image_sizing/
- Elastic (responsive) Video layout (for Mobile): http://webdesignerwall.com/tutorials/css-elastic-videos
- Responsive Data Tables (using CSS3 @media): http://css-tricks.com/responsive-data-tables/
- Adaptive Layout with CSS3 @media queries: http://www.catswhocode.com/blog/create-an-adaptable-website-layout-with-css3-media-queries
- How to use CSS3 Orientation Media Queries: http://www.1stwebdesigner.com/css/how-to-use-css3-orientation-media-queries/
- Space images out to match text height: http://zomigi.com/blog/css-effect-space-images-out-to-match-text-height/
- Detect Orientation Change on Mobile Devices: http://davidwalsh.name/orientation-change
- Responsive NAV patterns: http://bradfrostweb.com/blog/web/responsive-nav-patterns/
- Designing For Device Orientation - From Portrait To Landscape: http://uxdesign.smashingmagazine.com/2012/08/10/designing-device-orientation-portrait-landscape/
- Centering Percentage Width/Height Elements: http://css-tricks.com/centering-percentage-widthheight-elements/
- Using percentage widths -- auto adjust contents in a mobile web app: http://jbkflex.wordpress.com/2011/12/07/using-percentage-widths-auto-adjust-contents-in-a-mobile-web-app/
- jQuery Mobile - Full Height content area: http://www.semicomplete.com/blog/geekery/jquery-mobile-full-height-content.html
- Responsive, Centered Square Div that Resizes Based on Height in Landscape using CSS: http://blog.brianjohnsondesign.com/2013/responsive-centered-square-div-resizes-height/
- CSS: Clearing Floats with Overflow .vs. Dynamic Resizing: http://webdesignerwall.com/tutorials/css-clearing-floats-with-overflow
- On Responsive Images: http://css-tricks.com/on-responsive-images/
- Developing a Cross-Platform HTML5 Game (3 parts): http://css.dzone.com/articles/developing-cross-platform-0
- Build a Contacts Application With jQuery Mobile & the Android SDK: http://mobile.tutsplus.com/tutorials/mobile-web-apps/build-a-contacts-application-with-jquery-mobile-the-android-sdk-part-1/
- Introducing Adobe Edge: http://webdesign.tutsplus.com/tutorials/applications/introducing-adobe-edge-user-interface/
- Adobe Edge - Creating Regions in Timelines: http://www.htmlgoodies.com/html5/tutorials/adobe-edge-creating-regions-in-timelines.html
- Adobe Edge - First Look At New Scripting Features: http://webdesign.tutsplus.com/tutorials/applications/a-first-look-at-the-new-scripting-features-of-adobe-edge/
- Adobe Edge - Working With an Existing Web Page: http://webdesign.tutsplus.com/tutorials/applications/adobe-edge-working-with-an-existing-web-page/
- Adobe Edge - Animating Logos: http://webdesign.tutsplus.com/tutorials/applications/animating-the-wdtuts-logo-with-adobe-edge/
- A tel Tale Sign: http://bradfrostweb.com/blog/mobile/a-tel-tale-sign/
External Links
- wikipedia: Mobile Web
- wikipedia: Mobile Phone
- wikipedia: Telephone keypad
- Top 10 Reasons Your Website Should Go Mobile: http://searchengineland.com/top-10-reasons-your-website-should-go-mobile-32566
- Testing on Mobile Devices using Emulators: http://www.klauskomenda.com/archives/2008/03/17/testing-on-mobile-devices-using-emulators/
- Web guru Berners-Lee warns against 'walled gardens' for the Mobile Internet: http://www.networkworld.com/news/2007/111407-berners-lee-mobile-internet.html
- Women, Teens, and Seniors Help Fuel 34% Mobile Web Spike: http://blog.nielsen.com/nielsenwire/online_mobile/mobile-web-up-34-percent-july-09/
- Mobile Web Is Taking Over the World (and Other Internet Trends): http://mashable.com/2009/10/20/mobile-web-presentation/
- Mobile Japan Internet Report -- Forward Excerpt and Condensed Chapter List: http://wirelesswatch.jp/mobile-japan-2007/
- Mobile App or Browser-Based Site? Report Says The Browser Will Win on Mobile: http://www.readwriteweb.com/archives/mobile_app_or_browser-based_site.php
- State of the Mobile Web (Opera Mini savings): http://www.opera.com/business/newsletter/2010/04/smw/
- Character Encoding Issues and the Mobile Web: http://mobiforge.com/developing/story/character-encoding-issues-and-mobile-web
- Mobile Internet Portal Development on the NetBeans Platform: http://netbeans.dzone.com/nb-mobile-internet-portal
- 5 Ways HTML5 Is Changing Mobile Advertising: http://mashable.com/2010/09/24/html5-mobile-advertising/
- RIM Buys Developer Of HTML5 Mobile App Testing Platform TinyHippos: http://techcrunch.com/2011/03/26/rim-buys-developer-of-html5-mobile-app-testing-platform-tinyhippos/
- App stores are not the future, says Google: http://blogs.ft.com/fttechhub/2009/07/app-stores-are-not-the-future-says-google/
- A Quick Look at Mobile Web Designs: http://sixrevisions.com/user-interface/a-quick-look-at-mobile-web-designs/
- Mobile Users Prefer Browsers over Apps: http://www.emarketer.com/Article.aspx?R=1008010
- iPhone vs. Android – 45,000 Tests Prove Whose Embedded Browser is Faster (Android as of March, 2011): http://www.blaze.io/mobile/iphone-vs-android-45000-tests-prove-whose-browser-is-faster/
- Canada’s mobile internet data rates – legalized theft?: http://www.cellphones.ca/news/post002936/
- CSS Media Query for Mobile is Fool's Gold: http://cloudfour.com/css-media-query-for-mobile-is-fools-gold/
- HTTP Pipelining – Big in Mobile: http://www.blaze.io/mobile/http-pipelining-big-in-mobile/
- Mobile Pages That Are 1 Second Faster Experience Up to 27% Increase in Conversion Rate: http://dzone.com/articles/mobile-pages-that-are-1-second-faster-experience-u
References
- ↑ Mobile Web Application Best Practices: http://www.w3.org/TR/mwabp/
- ↑ wikipedia: HTML5 in mobile devices
- ↑ CSS3: http://www.w3.org/TR/css3-roadmap/
- ↑ HTML5 from a Mobile Perspective: http://www.cloudfour.com/html5-from-a-mobile-perspective/
- ↑ How to Create HTML5 iPhone Applications: http://blogfreakz.com/tutorial/html5-iphone-applications/
- ↑ CSS Mobile Profile 2.0: http://www.w3.org/TR/css-mobile/
- ↑ wikipedia: XHTML Mobile Profile
- ↑ Mobile Web Best Practices 1.0: http://www.w3.org/TR/mobile-bp/
- ↑ W3C mobileOK Basic Tests 1.0: http://www.w3.org/TR/mobileOK-basic10-tests/
- ↑ Comparison of XHTML Mobile Profile and XHTML Basic: http://mobiforge.com/designing/story/comparison-xhtml-mobile-profile-and-xhtml-basic
- ↑ wikipedia: i-Mode
- ↑ NTT DoCoMo - iMode official site: http://www.nttdocomo.com/services/imode/
- ↑ W3C - WAP Binary XML Content Format: http://www.w3.org/TR/wbxml/
- ↑ WAP flap zaps spec credibility: http://www.allbusiness.com/legal/intellectual-property-patent/980415-1.html
- ↑ An introduction to meta viewport and @viewport: http://dev.opera.com/articles/view/an-introduction-to-meta-viewport-and-viewport/
- ↑ Mobile Dimensions via CSS/META: http://www.yourhtmlsource.com/accessibility/mobile.html
- ↑ Viewports: http://www.quirksmode.org/mobile/viewports.html
- ↑ Table viewport: http://www.quirksmode.org/mobile/tableViewport.html
- ↑ Responsive Web Design: http://www.alistapart.com/articles/responsive-web-design/
- ↑ CSS contents and browser compatibility - mobile: http://quirksmode.org/m/css.html
- ↑ Sirens - CSS for adaptable content that responds to orientation changes: http://aaronmentele.com/2012/01/13/sirens-2/
- ↑ iPad 3 .vs. iPad 2 specs: http://www.apple.com/ipad/compare/
- ↑ Screen resolution - web usage statistics: http://www.webdevelopersnotes.com/design/web-screen-resolution-usage-statistics.php
- ↑ RIM PlayBook vs Apple iPad: http://www.knowyourmobile.com/comparisons/613275/rim_playbook_vs_apple_ipad.html
- ↑ Using the navigator object to detect client's browser: http://www.javascriptkit.com/javatutors/navigator.shtml
- ↑ Auto detect mobile browser (via user-agent?): http://stackoverflow.com/questions/1005153/auto-detect-mobile-browser-via-user-agent
- ↑ Browser detect: http://www.quirksmode.org/js/detect.html
- ↑ Lightweight Device-Detection in PHP: http://mobiforge.com/developing/story/lightweight-device-detection-php
- ↑ Mobile Device Detection and Redirection with PHP: http://www.mlynn.org/2010/06/mobile-device-detection-and-redirection-with-php/
- ↑ iPhone Tester: http://www.iphonetester.com/
- ↑ iPad Simulator: http://www.ipadsimulator.info/
- ↑ WebTelephony API and WebSMS API – Part of WebAPI: http://hacks.mozilla.org/2012/03/webtelephony-api-and-websms-api-part-of-webapi/
- ↑ Delivering the right experience to the right device: http://www.filamentgroup.com/lab/delivering_the_right_experience_to_the_right_device/
See Also
Mobile Internet | Mobile | Web | Optimization