<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Breaking the Mobile Web</title>
	<atom:link href="http://www.mobilexweb.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mobilexweb.com</link>
	<description>Techniques and best practices for delivering the best experience for each mobile device using HTML5</description>
	<lastBuildDate>Fri, 10 May 2013 16:25:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Background notification hack for iPad and iPhone websites</title>
		<link>http://www.mobilexweb.com/blog/background-notification-ipad-iphone</link>
		<comments>http://www.mobilexweb.com/blog/background-notification-ipad-iphone#comments</comments>
		<pubDate>Thu, 09 May 2013 19:27:10 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[hacks]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=227</guid>
		<description><![CDATA[Tweet Mobile browsers may look like desktop browsers, but their behavior sometimes is different and we need to understand them to provide the right user experience. In this post I&#8217;ll show you a trick to notify the user about an update while our website is on a background tab. While on desktop browsers, we can [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Background notification hack for iPad and iPhone websites  - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/background-notification-ipad-iphone"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p>Mobile browsers may look like desktop browsers, but their behavior sometimes is different and we need to understand them to provide the right user experience. In this post I&#8217;ll show you a trick to notify the user about an update while our website is on a background tab.<span id="more-227"></span></p>
<figure id="attachment_229" class="wp-caption alignnone"><a href="http://www.mobilexweb.com/wp-content/uploads/2013/05/background-trick.png"><img class="size-full wp-image-229" alt="At the top, Chrome for desktop showing updates on background tabs; at the bottom, Safari for iPad freezing background tabs" src="http://www.mobilexweb.com/wp-content/uploads/2013/05/background-trick.png" width="750" height="147" /></a><figcaption class="wp-caption-text">At the top, Chrome for desktop showing updates on background tabs; at the bottom, Safari for iPad freezing background tabs</figcaption></figure>
<p>While on desktop browsers, we can keep multiple running tabs, on most mobile browsers timers (and all JavaScript execution) are paused when the web page left the foreground status.</p>
<p>If you have an iPad, let&#8217;s say you have your webmail open in one tab. When you want to browse to another website, you open a new one. That means your email will be frozen for several hours or even days and you will never get updates, until you go back to that tab.</p>
<p>As developers, this raises an important issue: Is there any way to update the content and notify the user while the tab is in the background? As you can see with an iOS device at <a href="http://ad.ag/pdtdpw" target="_blank"><strong>http://ad.ag/pdtdpw</strong></a>, I&#8217;ve found a solution.</p>
<p><b>UPDATE</b>: The quick explanation on how this hacks works is:<em><br />
<strong>Safari on iOS freezes inactive tabs, but it honors the refresh meta declaration. After a reload, the tab is alive again while it is still in the background. A kind of &#8220;background tab resurrection&#8221; process.</strong></em></p>
<h3>Updating a background tab on iPad</h3>
<p>After making some research and testing, <strong>I&#8217;ve found a good solution compatible with iPad</strong> to notify the user of an update when the tab is in the background: our old friend, <strong>the meta refresh</strong>.</p>
<p>While it can be an annoying behavior from a user’s perspective when the page is active, the old HTML mechanism allows us to define a meta tag to reload a window automatically every <em>n</em> seconds. Some browsers, such as Safari on iOS, allow us to use this hack to automatically reload inactive tabs and keep them updated:</p>
<p><code>&lt;!-- Updates the page every 1 minute --&gt;<br />
&lt;meta http-equiv="refresh" content="60"&gt;<br />
</code></p>
<p>With this technique, the page will reload on the iPad and the inline scripts and the onload event will be executed in the background tab on every version of iOS. On iOS 5.x no other event or timer will be executed after the onload event until the user goes back to activate the tab. <strong>On iOS 6.x timers continue executing even in the background after an automatic refresh</strong>.</p>
<h3>Refreshing the tab only when in background</h3>
<p>The problem is how to remove the reload behavior when the page is the active tab and the user is using our website. Every time we set the <em>content</em> attribute dynamically in the meta tag, the browser starts counting again, so we shift the next reload hit. We can use this idea then to not refresh the page all the time.</p>
<p>To make the trick work on the iPad, we can <b>start a chronometer that will shift the refresh meta tag n seconds on every execution</b>. While the page is still active, our chronometer will be executed and the reload action will be shifted every n seconds. When the page goes onto a background tab, the chronometer will not be fired and the refresh meta tag will trigger, refreshing the page once. From iOS 6.1, after the refresh, the chronometer will continue executing pausing more reloads:</p>
<p><code>&lt;!-- Updates the page every 1 minute --&gt;<br />
&lt;meta http-equiv="refresh" content="60" id="metarefresh"&gt;<br />
&lt;script&gt;<br />
// iPad background tab notification trick<br />
var mr = document.getElementById("metarefresh");<br />
setInterval(function() {<br />
mr.content=mr.content; // Shift the reload operation<br />
}, parseInt(mr.content)/2); // Every 30 seconds in our example<br />
&lt;/script&gt;</code></p>
<h3>Creating a background notification</h3>
<p>iOS doesn&#8217;t support the <a href="http://www.mobilehtml5.org" target="_blank">Web Notifications API</a> as BlackBerry 10, Firefox for Android, Amazon Silk 2.0 and Firefox OS.</p>
<p>Unfortunately, Safari for iPad doesn&#8217;t make use of a favicon in the tab UI so our only option is to use the title element to update the UI and capture the user’s attention. Therefore we can change<strong> document.title</strong> to send information to the user via the tab’s title.</p>
<p>Therefore, if we just execute a chronometer and update the title, it will just work after the background reload. For example:</p>
<p><code>&lt;script&gt;<br />
var count = 0;<br />
setInterval(function() {<br />
document.title = count;<br />
count++<br />
}, 1000);<br />
&lt;/script&gt;</code></p>
<p>In this example, the counter will start from scratch every time we move the tab to the background as it reloads once. We can use sessionStorage to maintain values between reloads.</p>
<p>Chrome for Android supports background execution directly; therefore these tricks are not necessary. <a href="http://firt.mobi/pmw" target="_blank">Table 12-1</a> shows the background execution behavior in different browsers.</p>
<h3>What about iPhone?</h3>
<p>I&#8217;m not sure yet if this is good news or bad news: <strong>we can use window.alert from a background tab</strong> that was refreshed and it works! And this trick also works on iPhone where there are no tabs but background windows. But be careful, it&#8217;s a very intrusive dialog from a background tab or window. If it&#8217;s an iPad, changing the title for the tab seems like a better idea.</p>
<p>For iPhone or iPod touch we can then refresh the page and generate an alert dialog if there is something important we want to say. However, there is no way to automatic move the active window to ours; so the alert message should indicate that to see what&#8217;s happening the user should move to our window.</p>
<h3>Change the title only when in background</h3>
<p>In this example, the title is being updated all the time, even when the tab is in foreground. To change that, we need a way to separate foreground from background state after a reload. Without Page Visibility API it seems complicate. I have even tried with <a href="http://www.w3.org/TR/animation-timing/" target="_blank">Animation Timing API</a>, also known as <em>requestAnimationFrame </em>and even in the background, frames are being fired. At the time of this writing I couldn&#8217;t find an easy way to differentiate between foreground state and background after a reload state.</p>
<p>If you find a way, just add a comment in this post.</p>
<h3>But it doesn&#8217;t work on iOS 6.0 and 5.x!</h3>
<p>The previous code works perfect on iPad with iOS 6.1+ but on iOS 6.0 and 5.x it&#8217;s a different story. Because timers don&#8217;t fire  after the reload, we need a different approach. The approach on iOS &lt;= 6.0 is to just update the title when the page is being loaded and leave the meta refresh make its work every n seconds. In the count example, we can just use sessionStorage.</p>
<p><code>&lt;script&gt;<br />
var count = sessionStorage.getItem("count")||0;<br />
document.title = count;<br />
count++<br />
sessionStorage.setItem("count", count);<br />
&lt;/script&gt;</code></p>
<p>In this case we don&#8217;t have the problem as in iOS 6+ and we can update the title only in the background.</p>
<h3>Try it yourself</h3>
<p>If you have an iOS device with you, just go to <a href="http://ad.ag/pdtdpw" target="_blank"><strong>http://ad.ag/pdtdpw</strong></a></p>
<aside style="background-color: #eee; border: 1px solid #AAA; padding: 20px;">This post was partially extracted from <a href="http://firt.mobi/pmw" target="_blank">my book Programming the Mobile Web</a>, 2nd. edition published in 2013 by O&#8217;Reilly Media.</aside>
<h3><span style="font-size: 1.17em;">More about tabs</span></h3>
<p>On future posts I&#8217;ll continue talking about background tab management for mobile devices, including page visibility detection. If you can&#8217;t wait to that time, remember my book <a href="http://firt.mobi/pmw" target="_blank">Programming the Mobile Web</a>, 2nd edition has +750 pages on the topic :) This is a series of posts I&#8217;m publishing based on content extracted from that book.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/background-notification-ipad-iphone/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Developing for Google Glass: Mirror API, HTML5 and how to change your mind</title>
		<link>http://www.mobilexweb.com/blog/google-glass-web-mirror-api-html5</link>
		<comments>http://www.mobilexweb.com/blog/google-glass-web-mirror-api-html5#comments</comments>
		<pubDate>Tue, 16 Apr 2013 13:41:31 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[google glass]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=217</guid>
		<description><![CDATA[Tweet Google Glass is around the corner it&#8217;s time to prepare our services for this new device type. Reading the specs for the first time can be a little overwhelming; therefore I&#8217;ll try to make a quick go through the Glass app development process, the mirror API and its HTML5 support. The new screen A [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Developing for Google Glass: Mirror API, HTML5 and how to change your mind - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/google-glass-web-mirror-api-html5"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><img class=" wp-image-218 alignleft" style="margin-right: 15px;" alt="GOOGLE-GLASS-LOGO" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/GOOGLE-GLASS-LOGO.jpg" width="140" />Google Glass is around the corner it&#8217;s time to prepare our services for this new device type. Reading the specs for the first time can be a little overwhelming; therefore I&#8217;ll try to make a quick go through the Glass app development process, the mirror API and its HTML5 support.</p>
<h3><span id="more-217"></span>The new screen</h3>
<p>A mobile experience is not a smaller version of a desktop app or website. And a <strong>Google Glass app is not a mobile app or website on a transparent background</strong>.</p>
<p>If you have a mobile website or a mobile app and you want to support Google Glass, you need to sit down and understand how the device works and what users will expect from an app on it. BTW, a <strong>Google Glass app is known as Glassware</strong>.</p>
<p><img class="alignnone  wp-image-219" alt="headline" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/headline.jpg" width="80%" /></p>
<p><strong>Google Glass is not a mobile replacement;</strong> it&#8217;s more than a companion. The Glass, not having a cellular connection, needs a phone companion or WiFi to access its heart: the Google cloud. For example, geolocation is provided only if the Glass is paired with an Android 4.x phone.</p>
<h4>Important ideas</h4>
<ul>
<li>Users don&#8217;t browse the web on Glass (well, they can ask questions to Google but there is no API for that yet)</li>
<li>Users don&#8217;t install apps, they authorize just Glassware to communicate with the device as we authorize a website/app to access our Facebook/Google+ account</li>
<li>We need to let the user decide when to access your services and data, we should not force the user to read what we have to say</li>
<li>Create an specific and optimized architecture for Google Glass</li>
<li>While everybody thinks on Glass with AR (Augmented Reality), today the device is not offering AR features. We can send contextual information, images and videos to user&#8217;s device but we will not augment the reality on user&#8217;s vision.</li>
<li>It&#8217;s not a mobile replacement; it&#8217;s not a desktop replacement. It&#8217;s a new and different kind of device.</li>
</ul>
<h4>Device specs</h4>
<p>The first Google Glass device has a high-resolution <strong>nHD display</strong> 640&#215;360 (one ninth of a full HD) equivalent of a 25&#8243; HD screen from 2.5 meters or 8 feet away. It has a 5MP camera, a bone conduction transducer for audio (that means you don&#8217;t need to put earpieces for listening), accelerometer, a touch lateral panel, Bluetooth and WiFi. Check more about <a href="http://support.google.com/glass/answer/3064128?hl=en&amp;ref_topic=3063354" target="_blank">technical specs</a>.</p>
<h3>No native vs. web discussion</h3>
<p>Glassware can be developed <strong>only by using RESTful HTTP services</strong>. There is no native development or offline apps. Everything on Glass runs over the cloud and if we want to develop Glassware we have to use a server-side platform, such as Java, PHP, Node.JS or Python.</p>
<ul>
<li>No Java native development</li>
<li>No C++ native development</li>
<li>No HTML5 development (but it supports HTML5 content, later on this)</li>
<li>No Flash development; just joking here&#8230; ;)</li>
</ul>
<p>A user &#8220;installs&#8221; a Googleware from our website. Using OAuth 2.0 we will get permission to user&#8217;s Glass device that is attached to his/her Google account. Once we have been granted permission, we can now communicate bi-directional with the device through the Google cloud using the <a href="https://developers.google.com/glass/v1/reference/" target="_blank">Mirror API</a>, an HTTP RESTful-based API. More on how to start using it today, later on this post.</p>
<figure id="attachment_220" class="wp-caption alignnone"><img class=" wp-image-220 " alt="We authorize Googleware to access our Glass device through a website using OAuth 2.0" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/Screen-Shot-2013-04-15-at-11.45.11-PM.png" width="322" height="339" /><figcaption class="wp-caption-text">We authorize Googleware to access our Glass device through a website using OAuth 2.0</figcaption></figure>
<h3>Cards as the main interface</h3>
<p>The base of Glass interaction is the <strong>card</strong>. A card is a piece of content that appears on the Timeline (kind of a Glass&#8217; homepage) when you wake up your Glass using your voice saying &#8216;ok glass&#8217; or the touch panel. The user can flip between the available cards using the touch panel.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2013/04/cards.png"><img class="alignnone size-full wp-image-221" alt="cards" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/cards.png" width="700" height="130" /></a></p>
<p>Cards contain information pushed to the device from our servers and this is the most important change from a mobile pushing mechanism: <strong>it&#8217;s probable that our card will never be seen by the user</strong>. And that&#8217;s ok. It&#8217;s not like a mobile push notification. We push, update and delete cards from our server as many times as we need just for being there with refreshed data if the user thinks it&#8217;s time to see the timeline. Therefore, it&#8217;s possible that we are pulling a card before the user can really see it because the data became obsolete.</p>
<p>Card will be shown as a timeline (newer to older) but they can be also pinned, so they will always appear on the same place (remember, we can update cards&#8217; content anytime).</p>
<h4>Interaction with cards</h4>
<p><img class="size-full wp-image-222 alignright" alt="accion" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/accion.png" width="300" height="169" />A card can have <strong>menu items</strong> attached to a contextual menu tapping on the card so the user can interact with it. Typical system actions include: share, reply, delete, read aloud and pin. These actions have system behavior from the device itself but we can also create our own custom actions. Some actions, such as share, reply or a custom menu item will trigger an HTTP request to our server with the card meta data and the action so we can make things work on our side.</p>
<p>Just to give an example, if we enable the &#8220;Reply&#8221; menu item action and the user fires it from our card, the user can say something and on our server we will receive an HTTP request from Google&#8217;s servers with the original card metadata, the audio file and the transcript text. Cool!</p>
<h4>Sharing and suscriptions</h4>
<p>Our server can also register on the Glass to be notified of:</p>
<ul>
<li>a share action (so users can share other Glassware card with us)</li>
<li>user&#8217;s location (so we can generate or update cards with contextual information)</li>
</ul>
<p>In terms of sharing we can add a <strong>Contact</strong> to user&#8217;s device, a sharing destination that will appear in users share menu item. We will then receive that share action from any card through the suscription endpoint. It&#8217;s a good idea to have a web-based or mobile UI so the user can manage the Contacts that will appear on the device from our Googleware. Remember a contact is not just a person, it can be a group (such as Family) or a generic destination (such as &#8216;Twitter followers&#8217; or &#8216;my blog&#8217;).</p>
<h4>Multilevel cards</h4>
<p>Cards can also be bundled in groups, as in a folder in a mobile Home screen menu. In that case, a page curl effect will appear on the front card and the user can &#8220;enter&#8221; the bundle and then browser all the cards inside. These cards can be inserted, updated and deleted individually.</p>
<p>The other way is to provide one single card with different pages that will also appear similar to a bundle of different cards.</p>
<h4>Show me, show me!</h4>
<p>To see all these mechanisms working on stage, I suggest you seeing the following YouTube videos:</p>
<p><iframe src="http://www.youtube.com/embed/7zGayIdw77s?list=PLb77BMGbn7JHbLgh_0EHnXRR7nclVAQoU" height="315" width="560" allowfullscreen="" frameborder="0"></iframe></p>
<h3>HTML5 on Glass</h3>
<p>A card can be created using:</p>
<ul>
<li>Plain text</li>
<li>Text plus media (image, video or audio)</li>
<li>HTML5 content</li>
</ul>
<p>There are several HTML5 templates already available to use that fits perfectly on Glasses&#8217; screens and we can provide our own HTML code.</p>
<p><img class="alignnone size-full wp-image-223" alt="cards2" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/cards2.png" width="700" height="134" /></p>
<p>All the semantic HTML5 elements are supported, including images and tables and it&#8217;s not clear yet (I need to wait for a real device here&#8230; Google?) what happens with other type of content. Even, the CSS that Glass is using as the default user-agent stylesheet <a href="https://mirror-api-playground.appspot.com/assets/css/base_style.css" target="_blank">is available</a>.</p>
<p>One nice thing is that apart from using our own images on <em>&lt;img&gt;</em> elements we can access the native maps system using the <em>glass://map</em> URI scheme. This scheme allows us to show a map with optional points and polylines.</p>
<pre>&lt;img src="glass://map?w=240&amp;h=360&amp;marker=0;42.369590,-71.107132&amp;marker=1;42.36254,-71.08726" height="360" width="240"&gt;</pre>
<p>Just remember:</p>
<ul>
<li>Follow <a href="https://developers.google.com/glass/ui-guidelines" target="_blank">Glass card UI Guidelines</a></li>
<li>The user is not browsing the web, it&#8217;s just reading quickly a card</li>
<li>There is no scrolling: for more details, you can provide a multi-page card or enable a &#8220;read aloud&#8221; feature that can read more text than the one available on the screen</li>
<li>Don&#8217;t use any JavaScript or interactive HTML element, such as form elements</li>
<li>Design for a full card of 640&#215;360 with proper margins, using only following font sizes 30px, 34px, 40px, 50px and 70px or a special size for very short messages: 90px;</li>
</ul>
<h3>Glass emulator</h3>
<p>While there is no emulator available yet and devices are just being shipped only for Google Glass Explorer (did I say I&#8217;m waiting for one? ;)), we can start playing with Glassware with the &#8220;<a href="https://developers.google.com/glass/playground" target="_blank">Playground</a>&#8220;, a card viewer simulator. We can connect Playground with our OAuth client, we can use the HTML5 templates and see how they will look like on the real Glass.</p>
<figure id="attachment_224" class="wp-caption alignnone"><img class=" wp-image-224  " alt="Once connected to our Glassware, we can see and edit on the browser how cards look like" src="http://www.mobilexweb.com/wp-content/uploads/2013/04/playground-1024x681.png" width="700" /><figcaption class="wp-caption-text">Once connected to our Glassware, we can see and edit on the browser how cards look like</figcaption></figure>
<h3>Go and start playing</h3>
<p>Google Glass requires to rethink our app or website. Don&#8217;t just offer the same services you have on the web and/or on a mobile app. Be smart, simple, accurate and deliver info at the right time without interfering with user&#8217;s life.</p>
<p>I can&#8217;t wait to get my hands on a real device to feel how useful it might be and to check all we can do with HTML5-based cards.</p>
<p>&nbsp;</p>
<p>If you want to start right now playing with the Mirror API, Google is offering APIs for Java, Python, Go, PHP, .NET, Ruby and Dart. Starter Projects are available for Java and Python optimized for being executed on Google App Engine.</p>
<p>And remember, Glassware means just HTTP messages out and in our server-side app, so we can use any platform without using the API helpers from Google.</p>
<p>Official documentation: <a href="https://developers.google.com/glass" target="_blank">https://developers.google.com/glass</a></p>
<p>API and starter projects: <a href="https://developers.google.com/glass/downloads" target="_blank">https://developers.google.com/glass/downloads</a></p>
<p>Playground (card simulator): <a href="https://developers.google.com/glass/playground" target="_blank">https://developers.google.com/glass/playground</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/google-glass-web-mirror-api-html5/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>BlackBerry 10: the first class HTML5 mobile platform</title>
		<link>http://www.mobilexweb.com/blog/blackberry-10-first-class-html5-mobile-platform</link>
		<comments>http://www.mobilexweb.com/blog/blackberry-10-first-class-html5-mobile-platform#comments</comments>
		<pubDate>Mon, 25 Mar 2013 21:09:03 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[bb10]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[webworks]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=208</guid>
		<description><![CDATA[Tweet The new BlackBerry Z10 is on sale around the world with a whole new operating system and browser. In this post I&#8217;ll go through the important information for web and app developers about one of the most powerful HTML5 platforms available today. As a BlackBerry Elite developer, I had the opportunity of receiving one [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="BlackBerry 10: the first class HTML5 mobile platform - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/blackberry-10-first-class-html5-mobile-platform"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><img class="alignleft size-medium wp-image-209" style="margin-right: 20px;" alt="BlackBerry 10" src="http://www.mobilexweb.com/wp-content/uploads/2013/03/bb10logo-300x200.jpg" width="150" height="100" />The new BlackBerry Z10 is on sale around the world with a whole new operating system and browser. In this post I&#8217;ll go through the important information for web and app developers about one of the most powerful HTML5 platforms available today.</p>
<p><span id="more-208"></span></p>
<p>As a <a href="http://developer.blackberry.com/devzone/jamcommunity/bbelite/index.html" target="_blank">BlackBerry Elite developer</a>, I had the opportunity of receiving one of the first public BlackBerry Z10 devices in BBJam Europe in last February. Publishing the second edition of my book <a href="/book" target="_blank">Programming the Mobile</a> made me push this post until now. The good news is that if you are a web or an app developer, BB10 is a truly HTML5 first class platform through its completely rewritten web browser and the native web developer platform WebWorks.</p>
<p>First: <strong>The platform has nothing to do with previous BlackBerry devices</strong>; everything you know about BlackBerry has to be updated. Even the browser doesn&#8217;t identify itself as a BlackBerry (more on this later).</p>
<p>In this post, I&#8217;ll go through the following topics:</p>
<ul>
<li>New devices: BlackBerry Z10 and Q10</li>
<li>The browser and the native web app platform</li>
<li>Device detection</li>
<li>HTML5 support</li>
<li>WebWorks</li>
</ul>
<h3><a href="http://www.mobilexweb.com/wp-content/uploads/2013/03/bb10devices.jpg"><img class="size-medium wp-image-214 alignright" alt="bb10devices" src="http://www.mobilexweb.com/wp-content/uploads/2013/03/bb10devices-300x225.jpg" width="300" height="225" /></a>New devices</h3>
<p>The first device already available on some markets is the <strong><a href="http://us.blackberry.com/smartphones/blackberry-z10.html" target="_blank">BlackBerry Z10</a></strong>, a full touch device that is the first huge evolution in BlackBerry: no physical keyboard.  The second change is the operating system: BB10 is based on QNX and it&#8217;s a completely new operating system.</p>
<p>The Z10 includes a multi touch screen with a 1280&#215;768 pixels resolution, touch gestures everywhere and typical modern sensors: accelerometer, gyroscope, magnetometer, lightning and proximity. I&#8217;ve made my entire test using a final Z10 device (the developer edition).</p>
<p>The second device -the <strong>BlackBerry Q10</strong>- was announced. It will be a device with a QWERTY physical keyboard and a square screen of 720&#215;720 pixels. An experimental Alpha Device C is already available to developers emulating the Q10 factor. That&#8217;s the other device I&#8217;ve used for this post.</p>
<p>If you want to try test your web and apps without a device, BlackBerry offers a free virtual machine that includes the full browsers inside the Z10 and the Q10 (beta). You can <a href="http://developer.blackberry.com/devzone/develop/simulator/index.html" target="_blank">download the emulators</a> for free.</p>
<h3>The Browser and the native web app platform</h3>
<p>The default browser on the BlackBerry 10 platform is a completely new app mostly created form scratch based on the WebKit engine. One of the key features of the browser is that is an HTML5 application. Again, the browser was completely written in HTML5 using HTML, CSS and JavaScript and wrapped as a native app.</p>
<p>The BB10 browser is one of the most advanced default preinstalled browsers on the mobile space, because of its performance and HTML5 compatibility. It&#8217;s the first default browser passing the <a href="http://rng.io">Ringmark Level 1 test</a>. And it even supports half of the Level 2 requirements.</p>
<p>BlackBerry also has brought HTML5 to the front through its native web app platform known as WebWorks. With WebWorks we can package and compile an HTML5 app and distribute it through the store AppWorld. On a WebWorks app we can take advantage of more advanced native-like API to get access and interact with the operating system.</p>
<p>If you create native apps with the Cascades framework (based on Qt) you can also use a Web View to create a hybrid app.</p>
<h3>Device detection</h3>
<p>I&#8217;m not suggesting that we should use device detection. However, it&#8217;s important to understand how the browser identifies itself and how can we detect it for some specific situations.</p>
<p>The user agent on the Z10 looks like</p>
<pre>Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+</pre>
<p>Where is the BlackBerry word? Nowhere. The browser&#8217;s developers were forced to <strong>remove the &#8220;BlackBerry&#8221; keyword</strong> from the user agent because lots of websites -mostly from non-updated old CMSs and &#8220;mobilizers&#8221;- were just delivering a crappy website or even a WML website when a device identifies itself as &#8220;BlackBerry&#8221;.</p>
<p>Trying to start from scratch they use just the keyword BB10 to identify the platform. Unfortunately BlackBerry seems to be following Mozilla&#8217;s idea of not identifying the device model in the user agent.</p>
<p>Client-side detection can be done looking for the word &#8220;Research in Motion, Ltd.&#8221; in <em>navigator.platform</em> (even when the company is not called RIM anymore). We can detect the Q10 form factor (square screen) using media queries:<br />
<code>@media (device-aspect-ratio: 1/1) {<br />
/* It's the BlackBerry Q10 */<br />
}</code></p>
<h3>HTML5 support</h3>
<p>The BlackBerry 10 browser supports a big list of APIs as we can see in the updated <a href="http://www.mobilehtml5.org">Mobile HTML5 table</a>. It has one of the highest scores in <a href="http://html5test.com" target="_blank">HTML5Test.com</a> (485 points) and lot of un-prefixed CSS abilities, including some features that are still prefixed on other WebKit-based browsers. Besides typical modern HTML5, CSS and JavaScript support on other mobile platforms, BlackBerry 10 Browser includes:</p>
<ul>
<li>FullScreen API</li>
<li>WebGL</li>
<li>Media and Stream API (also known as getUserMedia) for live camera access (see image below)</li>
<li>IndexedDB</li>
<li>Web Notifications API (partially)</li>
<li>FileSystem and File API</li>
<li>W3C Touch events</li>
<li>HTML5 Form input controls (even type=color)</li>
<li>HTML Media Capture</li>
<li>Network Information API (latest version, different from Android Browser implementation)</li>
<li>Vibration API</li>
<li>Animation Timing API</li>
<li>Touch icon support through <em>apple-touch-icon</em> link element (150&#215;150 pixels)</li>
<li>Battery Status API</li>
<li>Performance Timing API</li>
<li>WebRTC preliminary support</li>
<li>Non-standard Extensions, such as <em>text-overflow: -blackberry-fade</em></li>
</ul>
<figure id="attachment_212" class="wp-caption alignnone"><img class="size-full wp-image-212 " alt="BlackBerry 10 Browser supports the ability to read user's camera on a website (image from Programming the Mobile Web book)" src="http://www.mobilexweb.com/wp-content/uploads/2013/03/camera.png" width="800" height="433" /><figcaption class="wp-caption-text">BlackBerry 10 Browser supports the ability to read user&#8217;s camera on a website (image from <a href="/book">Programming the Mobile Web book</a>)</figcaption></figure>
<h4>Background execution</h4>
<p>When the browsers get minimized, every website freezes so our JavaScript code won&#8217;t be executing. When the tab is being minimized and the user continues with the browser in foreground, our website continues execution but timer frequencies lower to 1 second. Remember for performance purposes we can use the Page Visibility API and the Animation Timing API. While in a background tab our page can also deliver web notifications (see bug consideration later in this post).</p>
<h4>Home Screen</h4>
<p>The BB10 Browser supports the <em>apple-touch-icon</em> link element as the icon to use when users add a site to the Home Screen but it seems to ignore the <em>sizes</em> attribute. Standard BB10 icons are 150&#215;150 pixels and PNG is recommended.</p>
<pre>&lt;link rel="apple-touch-icon" href="icon150.png"&gt;</pre>
<p>While the browser is not working full-screen (no support for webapp meta tag) the <em>navigator.standalone</em> boolean value is exposed so it might be possible that a full screen webapp mechanism through a meta tag will be available soon (as in Safari on iOS, MeeGo and Symbian).</p>
<h4>Responsive Images and Pixel density</h4>
<p>BlackBerry Z10 exposes a device pixel ratio of <em>2.2437500953674316</em> and BlackBerry Q10 a value of <em>2.075000047683716</em>. Therefore BB10 remembers us <strong>how important is to query about pixel ratio ranges and not integer values</strong>. Lot of websites are just querying about pixel ratio=2 because iOS high-resolution devices are using that value.</p>
<p>If you are using media queries to provide high resolution versions of your bitmap images, you can use for BB10<br />
<code>@media (-webkit-min-device-aspect-ratio: 2) {<br />
/* It includes any device with a pixel ratio &gt;= 2 */<br />
}</code></p>
<h4>Viewport and pixel density</h4>
<p>When using the viewport meta tag with width=device-width, BB10 will expose a 320px virtual viewport on all devices, maintaining the iOS standard. It&#8217;s important to understand that the BB Q10 has no landscape orientation (and remember, it&#8217;s a square screen anyway).</p>
<h4>Comparison</h4>
<p>Compared to Google Chrome for Android, the BlackBerry 10 browser supports a more HTML5 APIs. Compared to Safari on iOS 6, it supports more APIs and the only missing API is Web Audio that was included in iOS 6.</p>
<h4>Debugging</h4>
<p>BlackBerry 10 browser includes a full remote web inspector over HTTP (that is, connect your device to the same WiFi network as your desktop computer). Just enable it from the browser&#8217;s settings menu and you will get the URL to access it from a desktop browser. Just remember that anyone with that URL will be able to see and interact with your current opened sessions.</p>
<figure id="attachment_213" class="wp-caption alignnone"><a href="http://www.mobilexweb.com/wp-content/uploads/2013/03/debug.png"><img class=" wp-image-213 " alt="Using the developer tools from BlackBerry 10, we can use remote debugging through Wi-Fi" src="http://www.mobilexweb.com/wp-content/uploads/2013/03/debug-1024x572.png" width="717" height="400" /></a><figcaption class="wp-caption-text">Using the developer tools from BlackBerry 10, we can use remote debugging through Wi-Fi</figcaption></figure>
<h4>Bugs</h4>
<p>The <a href="http://www.w3.org/TR/notifications/" target="_blank">Web Notifications API</a> works, we can get user&#8217;s permission and deliver notifications. The device will show the notification on the Browser (red star) but there is no way to see the notification&#8217;s content or to understand which tab has generated the notification. The Web Notifications don&#8217;t appear to communicate with the Hub (the app that manages system notification on BB10).</p>
<p><a href="http://dev.w3.org/csswg/css3-regions/" target="_blank">CSS Regions spec</a> seems to be there in the DOM, but I couldn&#8217;t make it work so I believe it&#8217;s a bug.</p>
<p>I&#8217;m quite confident that BlackBerry will solve these bugs in a future OS update.</p>
<h3>WebWorks</h3>
<p>Using <a href="https://developer.blackberry.com/html5/" target="_blank">WebWorks</a> to compile the app as native webapp, we have access to all the HTML5 APIs plus a series of platform specific APIs, as:</p>
<ul>
<li>BlackBerry Messenger</li>
<li>Invoke</li>
<li>In-app Payments</li>
<li>Phone and Calls</li>
<li>PIM</li>
<li>Push</li>
<li>User Interface specifics, such as Toast notifications and Cover customization (update the snapshot when the app is minimized)</li>
</ul>
<p>Once compiled and signed, you can distribute and sell your HTML5 WebWorks app on the store (AppWorld). It&#8217;s great to see a platform supporting first-class HTML5 apps from the ground.</p>
<h3>Wrapping up</h3>
<p>A browser created using web technologies is another great example of what HTML5 can do on today&#8217;s smartphones.</p>
<p>BlackBerry 10 Browser is a good example of what developers expect from a good mobile browser: hardware APIs, good performance, easy to use debugging tools, good documentation and a way to create webapps outside of the browser. We will always expect better support but the BlackBerry 10 default browser had an excellent start.</p>
<p>If you want to know more about every HTML5 API listed in this post, check my last book <a href="/book">Programming the Mobile Web, 2nd edition</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/blackberry-10-first-class-html5-mobile-platform/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mission: Impossible &#8211; iPad mini detection for HTML5</title>
		<link>http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent</link>
		<comments>http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent#comments</comments>
		<pubDate>Mon, 05 Nov 2012 21:56:32 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=202</guid>
		<description><![CDATA[Tweet As you may know, the iPad mini is a new 7.9&#8243; variant of the iPad tablet and one of the biggest questions out there today is how to detect it using server-side or client-side techniques. I have bad news for you: it seems impossible. &#160; Two days ago, I&#8217;ve tweeted about the first detected problem: [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Mission: Impossible - iPad mini detection for HTML5 - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><img class="alignleft size-full wp-image-205" title="ipadmini1" src="http://www.mobilexweb.com/wp-content/uploads/2012/11/ipadmini11.png" alt="" width="200" height="134" />As you may know, the iPad mini is a<strong> new 7.9&#8243; variant of the iPad</strong> tablet and one of the biggest questions out there today is how to detect it using server-side or client-side techniques.</p>
<p>I have bad news for you: <strong>it seems impossible</strong>.</p>
<p><span id="more-202"></span></p>
<p>&nbsp;</p>
<p>Two days ago, I&#8217;ve tweeted about the first detected problem: &#8220;<strong>It is confirmed that the iPad Mini User Agent is the same as the iPad 2</strong>&#8220;. I&#8217;ve received literally hundreds of answers saying that user agent sniffing is a bad practice, that we should detect features not devices, etc, etc.</p>
<p>Well yes guys, you are right, but it has no direct relationship with the problem. And I need to add the second bad news: <strong>there is no client-side technique to make  &#8221;feature detection&#8221; neither</strong>.</p>
<h3>Why do we need to detect the iPad mini in first place</h3>
<p>The iPad Mini has no Retina display -the name that Apple gives to high resolution devices- and it&#8217;s an iPad 2 clone in terms of resolution: 768&#215;1024 pixels. The biggest difference is that while iPad 2 is 9,7&#8243;; the iPad mini is 7,9&#8243;.</p>
<p><img class="alignright size-full wp-image-204" title="ipadmini2" src="http://www.mobilexweb.com/wp-content/uploads/2012/11/ipadmini2.png" alt="" width="250" height="307" /></p>
<p>While it&#8217;s true that the difference between iPad 2 and iPad mini (1.8&#8243; or 4.57cm diagonally) is not so big compared to other series (Nexus 7 and Nexus 10 difference is 3&#8243;), we need to understand that <strong>everything looks 19% smaller on the iPad mini</strong>, including text and touch areas. (Update: <a href="http://stuffandnonsense.co.uk/blog/about/two-things-about-the-ipad-mini" target="_blank">real demo of this difference</a>)</p>
<p>Ok, you are right; we don&#8217;t really need to care about iPad mini vs. iPad 2 in terms of the device itself, but <strong>we do need to care about the dpi difference</strong>. Designers should want to make some things larger so they can be read properly, or to make touchable areas larger to avoid usability problems.</p>
<p>Second reason is analytics: some companies want to store information about user&#8217;s devices to make some decisions and in this case tablet size and factor, or device release date may be something useful. I know this is not a big problem, but it still sounds like an issue for some website and app owners.</p>
<h3>How to detect a feature or a device</h3>
<p>There are several mechanisms to make feature and device detection and it&#8217;s a long story. I have a full chapter on this topic in the second edition of my book Programming the Mobile Web (available <a href="http://shop.oreilly.com/product/0636920026259.do" target="_blank">today as a prerelease draft version</a>).</p>
<p>We should always prefer feature detection against device detection; but on some specific situations device detection is the only way to go.</p>
<p>When talking about server-side detection, the User Agent and/or device libraries, such as ScientiaMobile&#8217;s <a href="http://scientiamobile.com" target="_blank">WURFL</a> is the way to go. The User Agent thing is a mess and there is no simple rule to follow and, when a company like Apple decides to user the same User Agent for all devices, there is no server-side only solution that can help us. In this particular case, all the iPads out there, from the first to fourth generation and the iPad Mini uses the same User Agent. The only difference is the iOS version that they have.</p>
<p>I know many of you are thinking: I don&#8217;t care about server-side detection, a good practice following RWD &#8211; Responsive Web Design- principles is to use media queries or at least JavaScript to detect features. Well, the big bad news appears: <strong>there is no way to detect iPad mini unique features</strong> (dpi, screen size in inches/cm). Let&#8217;s see why.</p>
<h4>Using resolution media queries</h4>
<p>CSS3 Media queries includes a <em>resolution</em> attribute that we can query on. The <strong>iPad Mini has a 163 dpi</strong> resolution screen while iPad 2 has 132 dpi. Great! We have the solution&#8230; well, the resolution attribute is not available con WebKit-based browsers, such as Safari on iOS. No way to use it.</p>
<h4>Using device pixel ratio</h4>
<p>After that, we think on a non-standard media query extension: the device pixel ratio. High-resolution iPads expose a 2 value from both media queries and JavaScript for the device pixel ratio. Well, iPad Mini and also iPad 2 both expose a value of 1; so we can&#8217;t rely on this property neither.</p>
<h4>Using inches or centimeters units</h4>
<p>The other solution about dimensions in in (inches) or cm (centimeters). Well, trying to draw a 10 inches element on the screen, such as in <em>width: 10in</em>; I&#8217;ve got same results on both devices (that is, on the iPad mini the div is 19% smaller).</p>
<p><em>UPDATE: In the <a href="http://www.w3.org/TR/css3-values/#absolute-lengths" target="_blank">CSS3 spec</a>, inches or centimeters units might not match the physical size if the anchor unit is the pixel. Therefore they are useless on these devices.</em></p>
<p>Both iPad 2 and iPad mini exposes same device-width and device-height in inches and centimeters (it&#8217;s matching the pixel values) while we know that is completely false. The following media query is true for all the iPads:</p>
<p><code>only screen and (min-device-width: 8in)</code></p>
<p>And the iPad Mini has a device width smaller than 5.3 inches, so the query should be false in a first quick thought.</p>
<p>And with font size and font adjustment, the results are also exactly the same. There is no special text adjustment for the iPad mini and it&#8217;s using the same values.</p>
<p>If you want to try the media queries values yourself visit <a href="http://mediaqueriestest.com" target="_blank">mediaqueriestest.com</a> or <strong>m.ad.ag</strong> from your mobile device.</p>
<h3>Apple&#8230; why?</h3>
<p>I know some of you will find some obscure reasons, but the official reason is <strong>to reduce iOS fragmentation</strong>. From a developer and designer perspective we have only two devices: iPhones (including iPod touch) and iPads. That&#8217;s all you need to know from an Apple perspective to design and develop a website or an app. While is not a bad idea in a first thought, the iPad mini has a different screen size and that should be honor by the media queries at least.</p>
<p>To make a final conclusion, <strong>the problem is not that we can&#8217;t detect iPad mini; the problem is that we can&#8217;t detect its unique features, such as density and real dimensions</strong> that are important for delivering the best possible experience one ach device using responsive web design techniques.</p>
<h3>Solutions?</h3>
<p>UPDATE: People were asking by Twitter how to deal with this. Well, I can only think on some suggestions:</p>
<ol>
<li>Don&#8217;t disable zoom ability in the viewport metatag, such as in <em>user-scalable=no</em>.</li>
<li>If you have text offer the user the ability to increase and decrease font size and store the settings in Local Storage or a cookie for next visit. It can be easily implemented using JavaScript and you can change font-size or <em>-webkit-text-size-adjust</em>.</li>
</ol>
<div>Any other solution? Feel free to leave a comment</div>
<p><em>PS: Don&#8217;t get me wrong&#8230; I&#8217;ve tried the iPad mini and I like it; it feels good and the screen is much more useful than other 7&#8243; similar tablets.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent/feed</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Windows 8 and Microsoft Surface: IE10 meets modern mobile HTML5</title>
		<link>http://www.mobilexweb.com/blog/windows-8-surface-ie10-html5</link>
		<comments>http://www.mobilexweb.com/blog/windows-8-surface-ie10-html5#comments</comments>
		<pubDate>Wed, 17 Oct 2012 16:48:23 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[ie10]]></category>
		<category><![CDATA[native]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=185</guid>
		<description><![CDATA[Tweet October 26th 2012 is the big day for Microsoft: the launch of Windows 8, Internet Explorer 10 and the Microsoft&#8217;s tablet: the Surface. From an OS and an HTML5 point of view, it&#8217;s a really big step for Microsoft and for all web developers (even non-mobile) . Let&#8217;s review what&#8217;s important for us. I [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Windows 8 and Microsoft Surface: IE10 meets modern mobile HTML5 - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/windows-8-surface-ie10-html5"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><img class=" wp-image-186 alignleft" style="margin-right: 10px;" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/logo-150x150.png" alt="" width="105" height="105" />October 26<sup>th</sup> 2012 is the big day for Microsoft: the launch of Windows 8, Internet Explorer 10 and the Microsoft&#8217;s tablet: the Surface. From an OS and an HTML5 point of view, it&#8217;s a really big step for Microsoft and for all web developers (even non-mobile) . Let&#8217;s review what&#8217;s important for us.</p>
<p><span id="more-185"></span></p>
<p>I will start with some bad news: <strong>you need to go and prepare your websites for the new ecosystem</strong>.</p>
<p>Even if you have only a desktop-optimized website, you need to go and prepare it. And if you are thinking: &#8220;hey, this will not affect my mobile site because it&#8217;s just for tablets&#8221; you are wrong.</p>
<p><span style="color: #008000;"><em>Part of the content of this post are from my book &#8220;<a href="http://shop.oreilly.com/product/0636920026259.do"><span style="color: #008000;">Programming the Mobile Web, second edition</span></a>&#8221; to be published soon.</em></span></p>
<h3>Overview</h3>
<p>In this post, we will cover:</p>
<ul>
<li>Microsoft Surface tablet</li>
<li>Internet Explorer 10 modes</li>
<li>Flash Player</li>
<li>HTML5 compatibility</li>
<li>CSS3 compatibility</li>
<li>Snap mode and the viewport problem</li>
<li>Server-side identification</li>
<li>Pinned sites</li>
<li>Tablet Simulator</li>
<li>Store app integration</li>
<li>Windows Store HTML5 Apps</li>
</ul>
<h3>Microsoft Surface tablet</h3>
<p>Windows 8 will work on different kind of devices starting in just a few days; it will available as a Windows XP/Vista/7 update for desktop and many new desktop and notebook computers will start shipping with it. However, in this blog, I&#8217;m more focused on mobile devices and the <a href="http://www.microsoft.com/surface" target="_blank"><strong>Microsoft Surface</strong></a> is probably the first mobile device with this operating system.</p>
<p>Other hardware vendors are also starting to ship Windows 8 tablets but the Microsoft&#8217;s one will be like a key device in this environment.</p>
<p>First, it&#8217;s important to understand that Windows 8 is available in <strong>RT</strong> version and in a more classic version. The RT version works only on ARM-based devices, such as most tablets. The other version (available in many editions, such as Pro) is for Intel-compatible devices.</p>
<p><img class=" wp-image-187 alignnone" title="surface1" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/surface1.png" alt="" width="560" height="305" /></p>
<p>The Surface tablet is available both in RT and Win8 Pro versions, being the latest not available at the time of this writing. Why is this so important? The <strong>RT version doesn&#8217;t include the full desktop mode</strong> and that means, no classic windows, no desktop browsers that can be used. <strong>UPDATE</strong>: RT version do have a desktop mode but it runs only Microsoft apps, not x64 or x64 apps, such as other browsers.</p>
<p><em>Desktop users, and Windows 8 Pro tablets users will be able to install any Windows-compatible browser, such as Google Chrome, Firefox or Opera. However, they might not be optimized for touch-enabled browsing.</em></p>
<p>The Surface is a wide-screen tablet (16:9) with a <strong>medium density screen of 1366&#215;768 pixels</strong>. The RT version support 5 simultaneous touches and it has typical tablet sensors, such as accelerometer, gyroscope and magnetometer.</p>
<p>On the RT version <strong>only apps in the Windows Store can be installed/purchased</strong>. Windows Store apps (previously known as Metro apps) can be developed using .NET or HTML5 and must follow store rules. In terms of limitations and feature access, we can say that it&#8217;s kind of similar to iPad. It&#8217;s not the same, but you are not getting access to anything you want as in classic Windows development.</p>
<p>While Firefox is working on a <a href="http://blog.mozilla.org/futurereleases/2012/10/04/firefox-metro-preview/" target="_blank">Windows Store app version of the browser</a>, it&#8217;s not clear to me if it&#8217;s going to be approved in the store or not. It may be just a touch-enabled mode for non-RT devices (that can install apps without the store).</p>
<h3>Internet Explorer 10 modes</h3>
<p>On Windows 8 RT including the Surface tablet, the browser can be running in three modes:</p>
<p>1)   <strong>Landscape or portrait</strong>: IE10 is the only foreground active screen. On portrait the default viewport is 1024px.</p>
<figure id="attachment_192" class="wp-caption alignnone"><img class="size-full wp-image-192" title="" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/portraitlandscape2.png" alt="" width="700" height="458" /><figcaption class="wp-caption-text">IE10 taking all the available screen on landscape and portrait</figcaption></figure>
<p>2)   <strong>Snap mode</strong>: it&#8217;s sharing the active screen with some other Windows 8 Store app and the browser is snapped (right or left) using just a small portion of the screen (always same size). It only works on landscape mode and when the device has at least 1366px width.</p>
<figure id="attachment_190" class="wp-caption alignnone"><img class="size-full wp-image-190" title="" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/snap2.png" alt="" width="700" height="394" /><figcaption class="wp-caption-text">When in snap mode, IE10 will be using less than a quarter of the available screen</figcaption></figure>
<p>3)   <strong>Fill mode</strong>: it&#8217;s sharing the active screen with some other Windows 8 Store app in snap mode and the browser is talking 3/4 of the screen (filled). It only works on landscape mode and when the device has at least 1366px width.</p>
<figure id="attachment_193" class="wp-caption alignnone"><img class="size-full wp-image-193" title="" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/snap.png" alt="" width="700" height="394" /><figcaption class="wp-caption-text">IE10 can also share the screen with other snap app</figcaption></figure>
<p>On desktop mode, you can use a non-touch optimized Internet Explorer 10. That mode is the IE that we are used to. <strong>Internet Explorer 10 on desktop mode is available on both RT and non-RT versions of Windows 8</strong>.</p>
<h3>Flash Player</h3>
<p>Flash Player? What is that? :) Jokes apart, you believe you are in a desktop world with IE10 and you are not. Remember, &#8220;desktop meets mobile web&#8221;. Internet Explorer in desktop mode will support as much plugins as you want including Flash Player.</p>
<p>Most tablets, including the initial Surface, will use Windows 8 Store mode and that means <strong>no plugins, no Flash, HTML5 only</strong>. Well, that&#8217;s not completely true but your life will be much easier if you believe in that. Today, a week before Surface appears on the market, I don&#8217;t have any clear answer to know if it will include Flash Player or not.</p>
<p>However what I do know is that, <strong>if the device includes a Flash Player, IE10 on Windows 8 store mode (ex-Metro mode) will have it disabled by default</strong>. If you are not using a restricted API you can <a href="http://msdn.microsoft.com/en-us/library/ie/jj193557(v=vs.85).aspx" target="_blank">send an e-mail to Microsoft</a> so they can white-list your website so Flash movies will work on your website. As weird as it sounds, you need to send an email to be white-listed. If not, you can add a meta tag or an HTTP Header so Windows 8 store Internet Explorer will suggest you to move to desktop mode. Too complex in my opinion.</p>
<h3>HTML5 Compatibility</h3>
<p>Some good news! If we compare IE9 and IE10 I believe it&#8217;s one of the biggest steps from one version to the next one in the browser history. I know, they&#8217;ve taken 19 months to upgrade IE9.</p>
<p>IE10 supports:</p>
<ul>
<li>New form input types and validation API (excepting date-related ones and color)</li>
<li>Application Cache</li>
<li>Web Sockets</li>
<li>Web Workers</li>
<li>History</li>
<li>Drag and Drop</li>
<li>XHR 2</li>
<li>File API</li>
<li>IndexedDB</li>
<li>Page Visibility</li>
<li>DeviceOrientation</li>
<li>Touch, Pointer and Gesture APIs (non-standard)</li>
<li>Animation Timing API (aka requestAnimationFrame)</li>
</ul>
<p>If we compare it with Safari on iOS6, IE10 doesn&#8217;t have Web Audio and Web SQL (and it&#8217;s not going to add it in the future in favor of IndexedDB).</p>
<h3>CSS3 compatibility</h3>
<p>In terms of CSS3, IE10 has reached other browsers and in some situation has passed them with the addition of some experimental standards. IE10 is one of the first browsers supporting unprefixed well-known features, such as animations or transitions and it uses -ms- for other experimental styles.</p>
<p>IE10 supports:</p>
<ul>
<li>CSS Animations</li>
<li>CSS Transitions</li>
<li>CSS 2D and 3D transforms</li>
<li>CSS Fonts</li>
<li>CSS Gradients</li>
<li>CSS Device Adaptation (viewport definition through CSS)</li>
<li>CSS Exclusions</li>
<li>CSS Flexible Box (aka FlexBox)</li>
<li>CSS Grid Layout</li>
<li>CSS Multi-column layout</li>
<li>CSS Regions</li>
<li><del>CSS Filter</del> <strong>Update</strong>: it&#8217;s just SVG Filter support, CSS Filters are not supported.</li>
</ul>
<h3>Snap mode and the viewport problem</h3>
<p>As we saw before, our website can be browser in IE10 snap mode. And as you can see, IE10 maintains a default 1024px viewport if the current browser window is narrower than that width. Therefore every, again, every website today will be zoomed out by default as seen in the picture.</p>
<p>With the snap mode, desktop meets mobile web because every website should now have a similar mobile view for IE10 snap mode, even for desktop devices.</p>
<figure id="attachment_197" class="wp-caption alignnone"><img class="size-full wp-image-197" title="snap3" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/snap3.png" alt="" width="600" height="688" /><figcaption class="wp-caption-text">Any desktop website -such as NYTimes.com- will be zoomed out unless you define a viewport as in the image below for mediaqueriestest.com</figcaption></figure>
<p>If your website has a responsive design and will automatically work properly on a narrower screen, you can use the following viewport declaration<br />
<code>@-ms-viewport { width: device-width; }</code></p>
<p>To make our lives even stranger <strong>device-width will not be device&#8217;s width</strong> when in snap mode but the current window width.</p>
<p>If your website is not responsive and you want to provide a snap view mode you can define your own viewport mixed with some media queries as the following example:</p>
<p><code>@media only screen and (max-width: 400px) {<br />
@-ms-viewport { width: 320px; }<br />
}<br />
</code></p>
<p>Using 320px as a viewport will match most mobile device-width values, such as Safari on iPhone. I have a full explanation of this on my <a href="/book">book</a> (too much space to cover it in this post) and you can check <a href="http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/" target="_blank">Tim Kadlec great post</a>.</p>
<p>&nbsp;</p>
<h3>Server-side identification</h3>
<p>While you can use feature detection for most situations, sometimes server-side detection is necessary. The User Agent will never include hardware details. So we don&#8217;t know if we are on a Surface or other vendor&#8217;s tablet.</p>
<p>We can search for <strong>Windows NT 6.2</strong> to know we are on Windows 8, the <strong>Touch</strong> keyword will be there on touch devices and the <strong>ARM</strong> word will be on Windows 8 RT devices.</p>
<h3>Pinned sites</h3>
<p>We can pin websites to the Start Screen and customize its appearance defining our own tile icon and the background image.</p>
<p>To do so we use the <strong>msapplication-TileImage</strong> and <strong>msapplication-TileColor</strong> meta tags:</p>
<p><code>&lt;meta name="msapplication-TileImage" content="tile.png"&gt;<br />
&lt;meta name="msapplication-TileColor" content="#ef0303"&gt;<br />
</code></p>
<p>The tile image should be a <strong>144&#215;144 PNG file</strong>, with a preferred transparent background and the tile color accepts a CSS color as a value that should be the main color of your logo or visual presence. We can use hexadecimal RGB values (such as #333333), named values (such as red) or using CSS functions, such as rgb. If you don&#8217;t provide a color, IE will take it from the most prominent color of your website icon or your tile image. The color and icons are also used in history search and other places inside Internet Explorer.</p>
<p><img class="alignnone size-full wp-image-194" title="pin" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/pin.png" alt="" width="700" height="477" /></p>
<p><em>To combine with other icons, you can use just a white or black small icon over a plan color instead of a big colorful image. IE10 tile size 144&#215;144 is the same as the iPad high-resolution icon size. However, be careful using the same icon for both platform as the idea of how they are being rendered on the screen is really different.</em></p>
<p>Internet Explorer 10 will use your current title page for the tile. If we want to define a different one, we can use the title meta tag.</p>
<p><code>&lt;meta name="title" content="Tile title"&gt;</code></p>
<h4>Live badge notifications</h4>
<p>Of the big advantages of tile icons in Windows is the ability to update a badge number in the Start screen, so it becomes a <strong>Live Tile</strong>. Internet Explorer will poll for updates for pinned sites if we provide the right details.</p>
<p>First action is to create a badge XML, a really simple XML file that defines current badge number value to show inside the Tile. Of course, we can make a dynamic XML file.</p>
<p>The XML looks like</p>
<p><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;<br />
&lt;badge value="5" /&gt;</code></p>
<p>And then, we define using a msapplication-badge meta tag, the badge meta data, including frequency, and badge XML URL.</p>
<p><code>&lt;meta name="msapplication-badge" content="frequency=1440; polling-uri=http://mysite.com/badge.xml"&gt;</code></p>
<h3>Tablet simulator</h3>
<p>If you install Windows 8 on a desktop computer, Intel-based tablet or notebook, you can test most of the features of IE10. You can download a preview version for developers at <a href="http://windows.microsoft.com/en-US/windows-8/release-preview" target="_blank">http://windows.microsoft.com/en-US/windows-8/release-preview</a>.</p>
<p>However, for some situations, such as gesture events, orientation changes, etc. tablets and the RT version may be different.</p>
<p>We can install a <strong>Windows Simulator that works only on Windows 8</strong> and acts like a generic tablet device. You can download it for free included with Visual Studio Express for Windows 8.</p>
<p><img class="alignnone size-full wp-image-195" title="simulator" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/simulator.png" alt="" width="700" height="440" /></p>
<p>The Simulator allows us to emulate:</p>
<ul>
<li>Mouse, pointer or touch events</li>
<li>Gestures</li>
<li>Device rotation</li>
<li>Geolocation</li>
<li>Different screen resolutions</li>
</ul>
<h3>Store app integration</h3>
<p>If you have a Windows Store app (on Windows 8) you can connect your website to it with some meta tags. Internet Explorer will show a menu as shown in next image so the user can quickly get the app from the store if it&#8217;s not already installed. If the app is installed then the menu changes to <em>Switch to &lt;name&gt; app</em>.</p>
<p>If you are thinking on the similarities between this feature and <a href="http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers" target="_blank">Smart App Banners on iOS 6</a>, you are right. However, Microsoft has announced this feature before Apple.</p>
<figure id="attachment_196" class="wp-caption alignnone"><img class="size-full wp-image-196" title="" src="http://www.mobilexweb.com/wp-content/uploads/2012/10/app.png" alt="" width="700" height="367" /><figcaption class="wp-caption-text">In this case, a non-integrated website; a website that is integrated with an app (uninstalled); and the integration when the app is already installed.</figcaption></figure>
<p>There are five meta tags that can be defined in our website for this connection.</p>
<ul>
<li><strong>msApplication-ID</strong>: Mandatory. The identification that is defined in the application manifest.</li>
<li><strong>msApplication-PackageFamilyName</strong>. Mandatory. Package family created by Microsoft Visual Studio to identify the app.</li>
<li><strong>msApplication-Arguments</strong>. Optional. String that is going to be passed to your app. If we don&#8217;t provide this meta information, Internet Explorer will pass the current URL automatically.</li>
<li><strong>msApplication-MinVersion</strong>. Optional. Enforces a minimum version of your app. Therefore, if your user has an older version when she tries to switch to the app, she will be first sent to the store to update it.</li>
<li><strong>msApplication-OptOut</strong>. Optional. Allow our HTML document to not use the connection on some situations. Possible values are: install that will prevent the installation invitation if it&#8217;s not installed, switch that will prevent the switch invitation if the app is installed and both.</li>
</ul>
<p>The Windows Store App can be created using HTML5, C++, C# or Visual Basic and it must be approved by Microsoft on the store using a Publisher account.</p>
<p>To show you an example <strong>Cut the Rope</strong> is an addictive game available on many mobile platforms -such as iOS and Android- and they are offering an HTML5 version available -sponsored by Internet Explorer 10- online at <a href="http://cuttherope.ie" target="_blank">http://cuttherope.ie</a>. The game is also available as a Windows Store app so to offer the functionality seen on the figure they are using the following meta tags.</p>
<p><code>&lt;meta name="msApplication-ID" content="App"/&gt;<br />
&lt;meta name="msApplication-PackageFamilyName"<br />
content="ZeptoLabUKLimited.CutTheRope_sq9zxnwrk84pj"/&gt;</code></p>
<p>Remember you can find this info and more details on this and other stuff around mobile web on my book.</p>
<h3>Windows Store HTML5 Apps</h3>
<p>Using HTML5 and Visual Studio we can create native apps that can be distributed through the Store. The HTML5 engine uses all of the IE10 engine and much more. When in HTML5 App, we have other API, other possibilities and styles from CSS and some specifics to native app, as working with native controls using just divs.</p>
<h3>Conclusion</h3>
<p><strong>IE10 is the biggest step in Microsoft&#8217;s web life</strong>. Finally, IE meets modern HTML5 and it will make a change in the web world, as desktop or classic web meets mobile. Responsive sites will be more important in a world where users want our content anywhere. Just keep in mind that performance is one of the key issues of responsive sites; just be careful.</p>
<p>What do you think? Anything else that you believe I&#8217;ve not added in this list? Comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/windows-8-surface-ie10-html5/feed</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>iPhone 5 and iOS 6 for HTML5 developers, a big step forward: web inspector, new APIs and more</title>
		<link>http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers</link>
		<comments>http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers#comments</comments>
		<pubDate>Wed, 19 Sep 2012 09:00:18 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[ios6]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=169</guid>
		<description><![CDATA[Tweet The new main version of the Apple&#8217;s iOS is with us, along with the new iPhone 5 and the iPod Touch fifth generation. As every big change, lot of new stuff is available for HTML5 developers and -as always- no much official information is available. Quick review I&#8217;m going to divide this post in [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="iPhone 5 and iOS 6 for HTML5 developers, a big step forward: web inspector, new APIs and more - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><img class="alignleft" style="margin-right: 7px;" title="ios61" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios61-300x103.png" alt="" width="180" height="62" />The new main version of the Apple&#8217;s iOS is with us, along with the new iPhone 5 and the iPod Touch fifth generation. As every big change, lot of new stuff is available for HTML5 developers and -as always- no much official information is available. <span id="more-169"></span></p>
<h4>Quick review</h4>
<p><img class="alignright size-full wp-image-171" title="iphone5" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/iphone5.png" alt="" width="244" height="500" />I&#8217;m going to divide this post in two parts: <strong>iPhone 5 and iOS 6 new stuff</strong>.</p>
<p><strong>On iPhone 5:</strong></p>
<ul>
<li>New screen size</li>
<li>New simulator</li>
<li>What you need to do</li>
<li>Problems</li>
</ul>
<p><strong>New features on iOS 6:</strong></p>
<ul>
<li>File uploads and camera access with Media Capture and File API</li>
<li>Web Audio API</li>
<li>Smart App Banners for native app integration</li>
<li>CSS 3 Filters</li>
<li>CSS 3 Cross Fade</li>
<li>CSS Partial Image support</li>
<li>Full screen support</li>
<li>Animation Timing API</li>
<li>Multi-resolution image support</li>
<li>Passbook coupons and passes delivery</li>
<li>Storage APIs and web app changes</li>
<li>Web View changes for native web apps</li>
<li>Debugging with Remote Web Inspector</li>
<li>Faster JavaScript engine and other news</li>
</ul>
<h3>iPhone 5</h3>
<p>The new iPhone 5 -along with the iPod Touch 5<sup>th</sup> generation- has only one big change in terms of web development: screen resolution. These devices have a wide 4&#8243; screen, WDVGA (Wide Double VGA) <strong>640&#215;1136</strong>pixels, 326 DPI -Retina Display as Apple called it. These devices have the same width as iPhone 4/4S but 176 more pixels-height on portrait mode.</p>
<h4>New simulator</h4>
<figure id="attachment_170" class="wp-caption alignright"><img class="size-full wp-image-170 " src="http://www.mobilexweb.com/wp-content/uploads/2012/09/emulator.png" alt="" width="239" height="137" /><figcaption class="wp-caption-text">iOS Simulator on Xcode 4 includes iPhone 5 emulation</figcaption></figure>
<p>The new Xcode 4 (available on the <a href="http://itunes.apple.com/us/app/xcode/id497799835?mt=12" target="_blank">Mac AppStore</a>) includes the updated iOS Simulator. The new version has three options for the iPhone simulation:</p>
<ul>
<li>iPhone: iPhone 3GS, iPod Touch 1<sup>st</sup>-3<sup>rd</sup> generation</li>
<li>iPhone Retina 3.5&#8243;: iPhone 4, iPhone 4S, iPod Touch 4<sup>th</sup> generation</li>
<li>iPhone Retina 4&#8243;: iPhone 5, iPod Touch 5<sup>th</sup> generation</li>
</ul>
<p>The new simulator also includes the new Maps application replacing Google Maps by default and Passbook.</p>
<h4>What you need to do for the new devices</h4>
<p>Usually, if your website/app is optimized for vertical scrolling, you should not have any problem. Same viewport, icons and techniques for iPhone 4/4S should work properly.  Remember, when updating the iOS, you are also updating the Web View: that means that all the native web apps -such as PhoneGap/Apache Cordova apps- and pseudo-browsers such as Google Chrome for iOS are also updated. However <strong>if your solution is height-dependent, then you may have a problem.</strong>Just look at the following example of the Google Maps website on iPhone 4 and iPhone 5. As it is talking the height as a constant, the status bar is not hidden and there is a white bar at the bottom.</p>
<figure id="attachment_174" class="wp-caption alignnone"><img class=" wp-image-174 " title="maps" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/maps2.png" alt="" width="390" height="341" /><figcaption class="wp-caption-text">Be careful if you&#8217;ve designed for an specific height as Google Maps. As you can see (right caption is from iPhone 5) there is a white bottom bar and the URL bar can&#8217;t be hidden as there is no enough content.</figcaption></figure>
<p>If you are using Responsive Web Design you should not have too much trouble as usually, RWD techniques are using the width and not the height for conditionals.</p>
<h4>Device detection</h4>
<p>At the time of this writing there are no iPhone 5 on the street yet. However, as far as every test I could check, there is <strong>no way to detect iPhone 5 server-side</strong>. The user agent only specifies an iPhone with iOS 6, and the same exact user agent is being used for iPhone 4S with iOS 6 and iPhone 5.</p>
<pre>Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25</pre>
<p>Therefore, <strong>the only way to detect the presence of a 4&#8243; iPhone device is to use JavaScript and/or media queries</strong>, client-side. If you need to know server-side, you can plant a cookie from client-side for next load. Remember that these devices have 1136 pixels height, but in terms of CSS pixels (independent resolution pixels) we are talking about<strong> 568 pixels-height</strong>as these devices have a pixel ratio of 2.</p>
<pre>isPhone4inches = (window.screen.height==568);</pre>
<p>Using CSS Media Queries and Responsive Web Design techniques,we can detect the iPhone 5 using:</p>
<p><code>@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2) {<br />
/* iPhone 5 or iPod Touch 5th generation */<br />
}<br />
</code></p>
<h4>Home Screen webapps</h4>
<p>For Home Screen webapps the problem seems important. I&#8217;ve reported the problem while in NDA without any answer from Apple yet.</p>
<p>Basically, when you add a website to the Home Screen that supports <em>apple-mobile-web-app-capable </em>meta tag, your webapp works only in iPhone 3.5&#8243; emulation mode (it&#8217;s not taking the whole height) as you can see in the following example from the Financial Times webapp.</p>
<figure id="attachment_175" class="wp-caption alignnone"><img class="size-full wp-image-175 " title="Financial Times webapp on iPhone 5" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/ft.png" alt="" width="200" height="355" /><figcaption class="wp-caption-text">The letterbox black bars you see here are not a problem in the image. That is how a full-screen webapp is being launched by default on iPhone 5 and the new iPod Touch.</figcaption></figure>
<p>While it&#8217;s a good idea to not add more height to a webapp if the OS is not sure about it&#8217;s compatibility on a wider screen, as far as I could test, there is no way to define that our webapp is 4&#8243; compatible. I&#8217;ve tried as many combinations as I could think about, and if you provide an <em>apple-touch-startup-image</em> of <strong>640&#215;1096</strong>, the iPhone 5 takes your splash screen but it&#8217;s being resized to 640&#215;920, at least in the Simulator for the GM compilation (almost the final version).</p>
<p><a name="updatewebapps"></a><br />
<strong>UPDATE 9/20</strong>: Solution found, thanks to some guys that were pointing to some solutions I;ve found the trick. As weird as it sounds, <strong>you need to forget about the viewport with width=device-width or width=320</strong>. If you don&#8217;t provide a viewport, it will work properly. The same if you use other properties than width; if you don&#8217;t want your viewport to be the default 980px, the way to do it is:</p>
<p><code>&lt;meta name="viewport" content="initial-scale=1.0"&gt;</code></p>
<p>Even <strong>if you use a viewport for an specific size different than 320 letterbox will not be present</strong>.</p>
<p><code>&lt;meta name="viewport" content="width=320.1"&gt;</code></p>
<p>Instead of changing all your viewports right now, the following script will make the trick changing it dynamically:<br />
<code>if (window.screen.height==568) { // iPhone 4"<br />
document.querySelector("meta[name=viewport]").content="width=320.1";<br />
}</code></p>
<p>The startup image has nothing to do with the letterbox as some developers were reporting. Of course, if you want to provide your launch startup image it has to be 640&#215;1096 and you can use media queries to use different images on different devices. Some reports were saying that you need to name the launch image as in native apps &#8220;Default-568h@2x.png&#8221; but it&#8217;s not true. <strong>You can name it however you want. The sizes attribute is completely ignored.</strong></p>
<p>You can use media queries to provide different startup images:</p>
<p><code>&lt;link href="startup-568h.png" rel="apple-touch-startup-image" media="(device-height: 568px)"&gt;<br />
&lt;link href="startup.png" rel="apple-touch-startup-image" sizes="640x920" media="(device-height: 480px)"&gt;</code></p>
<p>If you want to provide an alternative version for low resolution devices then you can use the -webkit-device-pixel-ratio conditional too. If you are wondering why 568px and not 1136px remember that we are using CSS pixels and in these devices the pixel ratio is 2.</p>
<p><strong>The trick is the viewport. Why? I don&#8217;t really know</strong>. For me, it&#8217;s just a bug. But it&#8217;s the only solution I&#8217;ve found so far.</p>
<p>The other problem is with Home Screen icons that you are already have before buying your new device. iTunes will install the shortcut icon again from your backup and it&#8217;s not clear if we are going to have a way to upgrade the compatibility. Even if you change the viewport, if the icon is already installed before the change you will get the letterbox.</p>
<h3>iOS 6 and HTML5 development</h3>
<p>iOS 6 is available as a free update for every iOS 5 device but not the iPad first generation so we will see this version browsing the web really soon and the <strong>iPad market is being fragmented </strong>for the first time. The following findings are useful for all iOS devices that are talking the iOS 6 upgrade. As always -and unfortunately- Apple is giving us just partial and incomplete updates on what&#8217;s new on Safari and I -as always- enter the hard work of digging into the DOM and other tricks to find new compatibility.</p>
<h4>File management</h4>
<div>Finally! Safari for iOS 6 supports a file upload input type and with <a href="http://www.w3.org/TR/html-media-capture/" target="_blank">HTML Media Capture</a> partial support.</div>
<div></div>
<div>A simple file upload as the following, will ask the user for a file, from the Camera or Gallery as you can see in the figure. I really like how Safari is showing you screenshots instead of a temporary filename after selecting your image.</div>
<p><code> &lt;label&gt;Single file&lt;/label&gt;<br />
&lt;input type="file"&gt;<br />
</code><br />
We can also request multiple files using the HTML5 new boolean attribute. In this case, the user can&#8217;t use the camera as a source.<br />
<code>&lt;label&gt;Multiple files&lt;/label&gt;<br />
&lt;input type="file" multiple&gt;</code></p>
<figure id="attachment_176" class="wp-caption alignnone"><img class="size-full wp-image-176" title="camera" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/camera.png" alt="" width="650" height="416" /><figcaption class="wp-caption-text">We can access the camera and gallery using file uploads</figcaption></figure>
<p>There is no way to force the camera, as using capture=&#8221;camcorder&#8221;. However, we can specify if we want to capture images or videos only, using the <em>accept</em> attribute.</p>
<p><code>&lt;input type=file accept="video/*"&gt;<br />
&lt;input type=file accept="image/*"&gt;<br />
</code></p>
<p>There is <strong>no support for other kind of files</strong>, such as audio, Pages documents or PDFs. There is <strong>no support for getUserMedia</strong> for live camera streaming.</p>
<p>What you can do with the image or video after selected?</p>
<ul>
<li>Send it using multipart POST form action (old-fashion upload mechanism)</li>
<li>Use <a href="http://www.w3.org/TR/XMLHttpRequest/" target="_blank">XMLHttpRequest 2</a> to upload it using AJAX (even with progress support)</li>
<li>Use the <a href="http://www.w3.org/TR/FileAPI/" target="_blank">File API</a> that is available on iOS 6 that allows JavaScript to read the bytes directly and manipulate the file client side. There is a good example of this API in action on <a href="http://www.html5rocks.com/en/tutorials/file/dndfiles/" target="_blank">HTML5Rocks</a>.</li>
</ul>
<h4>Web Audio API</h4>
<p>HTML5 game developers should be happy! <a href="http://www.w3.org/TR/webaudio/" target="_blank">Web Audio API</a> appears on a mobile browser for the first time. This API allow us to process and synthesize audio on JavaScript. If you have never played with some low level audio, the API may seems a little weird, but after a while is not so hard to understand. Again, <a href="http://www.html5rocks.com/en/tutorials/webaudio/intro/" target="_blank">HTML5Rocks</a> has a great article to begin with the Audio API.</p>
<p>More information and news on the API on <a href="http://www.html5audio.org" target="_blank">http://www.html5audio.org</a></p>
<h4>Smart App Banners</h4>
<p>Website or native app? If we have both, now we can join efforts and <strong>connect our website with our native app</strong>. With Smart App Banners, Safari can show a banner when the current website has an associated native app. The banner will show a &#8220;INSTALL&#8221; button if the user doesn&#8217;t have the app installed or a &#8220;VIEW&#8221; button to open it if installed. We can also send arguments from the web to the native app. The case is to open the native app on the same content that the user were seeing on the web site.</p>
<p>To define a Smart App Banner we need to create a meta tag, with <em>name=&#8221;apple-itunes-app&#8221;</em>. We first need to go and search for the app we have on <a href="http://itunes.apple.com/linkmaker/" target="_blank">iTunes Link Maker</a> and take the app ID from there.</p>
<p><code>&lt;meta name="apple-itunes-app" content="app-id=9999999"&gt;</code></p>
<div>We can provide a string value for arguments using <em>app-argument</em> and if we participate in the<a href="http://www.apple.com/itunes/affiliates/" target="_blank"> iTunes Affiliate program</a> we can also add <em>affiliate-data</em> in the same meta tag.</div>
<p><code>&lt;meta name="apple-itunes-app" content="app-id=9999999, app-argument=xxxxxx"&gt;<br />
&lt;meta name="apple-itunes-app" content="app-id=9999999, app-argument=xxxxxx, affiliate-data=partnerId=99&amp;siteID=XXXX"&gt;</code></p>
<p>The banner takes 156 pixels (312 on hi-dpi devices) at the top until the user click on the bottom or on the close button and your website will get the full height for you. It acts like a DOM object at the top of your HTML but it&#8217;s not really on the DOM. On iPad -and more on landscape- it seems a little space-wasting.</p>
<div>
<figure id="attachment_177" class="wp-caption alignnone"><img class="size-full wp-image-177" title="smartapp" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/smartapp.png" alt="" width="650" height="155" /><figcaption class="wp-caption-text">With Smart App Banners, the browser will automatically invite the user to install or open a native app</figcaption></figure>
</div>
<p>During some seconds, the banners shows a &#8220;loading&#8221; animation while the system is verifying that the app suggested is valid to the current user&#8217;s device and App Store. If it&#8217;s not valid, the banner hides automatically; for example, it&#8217;s an iPad-only app and you are browsing with an iPhone or the app is available only on the german App Store and your account is in US.</p>
<h4>CSS 3 Filters</h4>
<p><a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html" target="_blank">CSS 3 Filters</a> a set of image operations (filters) that we can apply using CSS functions, such as grayscale, blur, drop-shadow, brightness and other effects. These functions will be applied before the content is rendered on screen. We can use multiple filters using spaces (similar to transforms).</p>
<p>You can try a nice <a href="http://html5-demos.appspot.com/static/css/filters/index.html" target="_blank">demo here</a>. A quick example of how it looks like:</p>
<pre>-webkit-filter: blur(5px) grayscale (.5) opacity(0.66) hue-rotate(100deg);</pre>
<h4>CSS 3 Cross-fade</h4>
<p>iOS 6 start supporting some of the new <a href="http://www.w3.org/TR/2011/WD-css3-images-20110217/#cross-fade-function" target="_blank">CSS Image Values</a>  standard, including the <em>cross-fade</em> function. With this function, we can apply two images on the same place with different levels of opacity and it can even part of a transition or animation.</p>
<p>Quick example:<br />
<code>background-image: -webkit-cross-fade(url("logo1.png"), url("logo2.png"), 50%);</code></p>
<h4>Full screen in Safari</h4>
<p>Besides the chrome-less home screen meta tag, now the iPhone and iPod Touch (not the iPad) supports a full-screen mode when in landscape. This is perfect for immersive experiences such as games or multimedia apps. There is no way to force full-screen mode and it needs to be launched by the user (last icon on the toolbar). However, we can invite the user to move to landscape first and press on the full-screen icon to activate our app. If we mix this with some touch event handling we can hide the URL bar and provide a good interface until the user escape from the full-screen.</p>
<figure id="attachment_178" class="wp-caption alignnone"><img class="size-full wp-image-178" title="fullscreen" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/fullscreen.png" alt="" width="650" height="234" /><figcaption class="wp-caption-text">Fullscreen navigation on iPhone and iPod Touch</figcaption></figure>
<p>You will always find two or three overlay buttons at the bottom that your design should be aware of, that&#8217;s the back button, the optional forward button and the cancel full-screen.</p>
<p>You can use the <em>onresize</em> event to detect if the user is changing to full-screen while in landscape.</p>
<h4>Animation Timing API</h4>
<p>Game developers, again, you are lucky. iOS 6 supports <a href="http://www.w3.org/TR/animation-timing/" target="_blank">Animation Timing API</a>, also known as requestAnimationFrame, a new way to manage JavaScript-based animations. It&#8217;s webkit prefixed, and for a nice demo and more detailed explanation check this <a href="http://paulirish.com/2011/requestanimationframe-for-smart-animating/" target="_blank">post from Paul Irish</a>.</p>
<h4>CSS Image Set</h4>
<p>This is not part of any standard group yet. It&#8217;s a new image function, called <em>image-set</em> receiving a group or images with conditions to be applied. The only compatible conditions right now seems to be 1x and 2x for low density devices and high density devices. With this new function we don&#8217;t need to use media queries to define different images for different resolutions. The working syntax is:<br />
<code>-webkit-image-set(url(low.png) 1x, url(hi.jpg) 2x) </code><br />
It&#8217;s working on CSS, such as a <em>background-image</em>. I couldn&#8217;t make it work on the HTML side, for the <em>src</em> attribute on an img element or the new proposed <em>picture</em> element. With this new syntax we can have more clear multi-resolution image definition, as we don&#8217;t need to use media queries and <em>background-size</em> values.</p>
<h4>Passbook coupons and passes delivery</h4>
<p><img class="alignright size-full wp-image-181" title="coupon" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/coupon.png" alt="" width="200" height="382" />Passbook is a new app in iOS that works as a virtual container for all your passes, ticket, discount coupons, loyalty cards and gift cards. As a web developer you may want to serve the user with a discount coupon, a ticket to an event, an e-ticket for your next flight or a loyalty card.</p>
<p>Apple allow <strong>websites to deliver this kind of passes from a website without the need of a native app</strong>.</p>
<p>To deliver the pass on your website you just need to use the MIME type <em>application/vnd.apple.pkpass </em>or send it through email</p>
<p>Apple provides a tool that you can install on your server to package and sign customized passes on the fly that may include current user information</p>
<p>To pass file is just a JSON meta-data file and a couple of images. We need to package the file and sign it. Unfortunately, <strong>to sign the pass we need a signature from Apple</strong> and that means that the web developer needs an iOS Developer Program account ($99/year). If you receive the pass already signed, you can just insert it on your own site.</p>
<p>One of the great features of passes is that once installed you can provide some web services on your end and through Push Notification Services, the operating system will call your web services to update the information on the pass.</p>
<p>More information at <a href="https://developer.apple.com/passbook" target="_blank">developer.apple.com/passbook</a></p>
<h4>Storage APIs and webapp updates</h4>
<p>No, there is no new storage API available. There is no support for IndexedDB yet. However, there are some changes you should take in consideration:</p>
<ul>
<li><strong>Application Cache</strong> limit was increased to <strong>25Mb</strong>.</li>
<li><strong>Chromeless webapps</strong> (using the <em>apple-mobile-web-app-capable</em> meta tag) now <strong>have their own storage sandbox</strong>. That means that even if they are served from the same domain, the web app from the Home Screen will have its own persistent Local and SQL Storage. Even if you install the icon many times, every icon will have its own sandbox. While this is good news for apps, it may be also a problem on some apps if you are passing information from the website to the home screen widgets through storage.<br />
<em>Credits for this finding to George Henne on his <a href="http://www.nsbasic.com/blog/?p=928" target="_blank">post</a>.</em></li>
<li>There is a new undocumented meta tag that can be used on any website (having the <em>apple-mobile-web-app-capable</em> meta tag or not) that allow us to define a <strong>different title for the Home Screen icon</strong>. As you may know, by default Safari takes the document&#8217;s title and crop it to 13 characters. Now we can define an alternative title for the Home Screen using:</li>
</ul>
<p><code>&lt;meta name="apple-mobile-web-app-title" content="My App Name"&gt;</code></p>
<p>I&#8217;ve also found a meta tag called <em>apple-mobile-web-app-orientations</em> accepting the possible values <em>portrait</em>, <em>portrait-upside-down</em>, <em>landscape-right</em>, <em>landscape-left</em>, <em>portrait-any</em>. Unfortunately, I couldn&#8217;t make it work. If you have any luck feel free to comment here.</p>
<h4>Web View updates</h4>
<p>On Web View (pseudobrowsers, PhoneGap/Cordova apps, embedded browsers) JavaScript now runs 3.3x slower (or let&#8217;s say that Nitro engine on Safari and Web apps is 3.3x faster). <em>Be careful about the 3.3x, that is just the different of running SunSpider on the same device, on Web View and Safari. However, SunSpider is not covering all possible kind of apps and your total rendering time is not just JavaScript, so this doesn&#8217;t mean that your app runs 3.3x slower.</em></p>
<p>We can find some other good news:</p>
<ul>
<li>Remote Web Inspector for <strong>webapp debugging</strong></li>
<li>A new <em>supressesIncrementalRendering</em> Boolean attribute that can <strong>eliminate the partial rendering mechanism</strong>. I believe this feature is useful to reduce the perception of loading a web page instead of being an app.</li>
<li>A new <em>WebKitStoreWebDataForBackup</em> info.plist Boolean feature where we can define that we want localStorage and Web SQL databases to be stored in a place to be backed up, such as in iCloud. This problem has appeared in iOS 5.01, now it&#8217;s solved</li>
<li><strong>Changes in the developer agreement</strong>: it seems that the restriction of using only the native WebView to parse HTML and JS has gone. It will be good if someone from Apple can confirm this. The only mention to the internal WebKit engine is that it&#8217;s the only engine capable of downloading and execute new code, while in the same app expected behavior; that&#8217;s the <strong>anti-Chrome statement</strong>. You can use your own engine but only if you are not downloading the code from the web. This may be opening a door&#8230; such as delivering our own engine, for example, with WebGL support.</li>
</ul>
<h4>Remote Debugging</h4>
<p>I&#8217;m keeping this topic at the end. Because it&#8217;s a huge change for web developers. For the first time, Safari on iOS includes an official Remote Web Inspector. Therefore tools, such as <a href="http://www.iwebinspector.com" target="_blank">iWebInspector</a> or Weinre will become obsolete since this version. The Remote Debugger works with the Simulator and with real devices via USB connection only.</p>
<p>To start a remote inspection session you need to use <a href="http://www.apple.com/safari/" target="_blank">Safari 6 for desktop</a>. Here comes the bad news: you can only debug your webapp on a Mac desktop computer. It was a silent change, but Safari for Windows is not available anymore, so it&#8217;s stuck in 5.x. Therefore, only with a Mac OS computer you can make web debugging session on your iOS devices (at least officially for now).</p>
<p>For security reasons, you need to first enable the Web Inspector from <em>Settings &gt; Safari &gt; Advanced</em>. The new Inspector means that the old JavaScript console is not available anymore.</p>
<p><img class="alignnone size-full wp-image-179" title="debugger1" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/debugger1.png" alt="" width="895" height="283" /></p>
<p>You can start a debugging session with:</p>
<ul>
<li>A safari window on your iOS device or simulator</li>
<li>A chrome-less webapp installed on your iOS device or simulator</li>
<li>A native app using a Web View, such as Apache Cordova/PhoneGap apps.</li>
</ul>
<p>When talking about native apps, you can only inspect apps that were installed in the device by Xcode (your own apps). Therefore, there is no way to inspect Google Chrome on iOS websites for example.</p>
<div><img class="alignnone  wp-image-180" title="debugger2" src="http://www.mobilexweb.com/wp-content/uploads/2012/09/debugger2.png" alt="" width="820" height="478" /></div>
<div></div>
<p>If you are used to the Webkit Inspector -Safari 5 or Chrome-, you are going to see a <strong>completely redesign version of the inspector</strong> in Safari 6 based on Xcode native development UI. You will be lost for a while understanding the new UI. With the inspector session, you can:</p>
<ul>
<li>See and make live changes on your HTML and CSS</li>
<li>Access your storages: cookies, local storage, session storage and SQL databases</li>
<li>Profile your webapp, including performance reports for Network requests, Layout &amp; Rendering and JavaScript and events. This is a big step in terms of performance tools.</li>
<li>Search on your DOM</li>
<li>See all the warning and errors in one place</li>
<li>Manage your workers (threads)</li>
<li>Manage JavaScript breakpoints, and define Uncaught exception breakpoint.</li>
<li>Access the console and execute JavaScript</li>
<li>Debug your JavaScript code</li>
<li>Touch to inspect: There is a little hand icon inside the inspector that allows you to touch on your device and find that DOM element on the inspector.</li>
</ul>
<p><strong>Well done Apple, we were waiting for this on iOS for long time</strong>. Apache Cordova users should be also happy with this feature.</p>
<h3>Other smaller updates</h3>
<ul>
<li>Apple claims to have a <strong>faster JavaScript engine</strong>. And it seems to be true. On the SunSpider test I&#8217;m receiving <strong>20% improvement</strong> on JavaScript performance on the same device with iOS 5.1 and iOS 6.</li>
<li> <strong>Google Maps is not available anymore on iOS 6</strong>; Now <em>http://maps.google.com</em> redirects to the Google Maps website and not the native app. there fore there is a new URL scheme, maps, that will open the native new Maps applications. The syntax is <strong>maps:?q=&lt;query&gt;</strong> and query can be just a search or latitud and longitude separated by comma. To initiate a route navigation, the parameters are: <strong>maps:?saddr=&lt;source&gt;&amp;daddr=&lt;destination&gt;</strong>.</li>
<li> XHR2: Now the XMLHttpRequestProgressEvent is supported</li>
<li>The autocomplete attribute of the input is officially in the DOM</li>
<li><strong>Mutation Observers</strong> from DOM4 are now implemented. You can catch a change in the DOM using the WebKitMutationObserver constructor</li>
<li>Safari no longer always creates hardware-accelerated layers for elements with the <em>-webkit-transform: preserve-3d</em> option. <strong>We should stop using it for performance technique</strong>s.</li>
<li>Selection API through window.selection</li>
<li>&lt;keygen&gt; element</li>
<li><strong>Canvas update</strong>: Now the <em>createImageData</em> has one parameter and now there are two new functions that the name suggest to be prepared to provide <strong>High Resolution images</strong> <em>webkitGetImageDataHD</em> and <em>webkitPutImageDataHD</em>.</li>
<li>Updates to SVG processor and event constructors</li>
<li>New CSS viewport related measures: vh (viewport height) vw (viewport width) and vmin (minimum between vw and vh)</li>
<li><a href="http://dev.w3.org/csswg/css3-exclusions/">CSS3 Exclusions</a> and <a href="http://html.adobe.com/webstandards/cssregions/" target="_blank">CSS Regions</a> were available on beta 1 but they were removed from the final version. It&#8217;s a shame although they were too new and not mature enough.</li>
<li><strong>iCloud tabs</strong>. You can synchronize your tabs between all your devices, including Macs, iPhones and iPads. So the same URL will be distributed through all devices. Be careful on your mobile web architecture!</li>
</ul>
<h3>What we are still waiting for</h3>
<p>There are a couple of things that we still need to wait for a next version, such as:</p>
<ul>
<li>IndexedDB</li>
<li>FileSystem API</li>
<li>Performance Timing API</li>
<li>WebRTC and getUserMedia</li>
<li>WebGL -still there and still disabled-</li>
<li>Orientation Lock API for gaming/inmersive apps</li>
<li>Integration with Facebook and Twitter Accounts native APIs, so we can use current OS user&#8217;s credentials automatically instead of forcing the user to log in again.</li>
</ul>
<h3>Final Thoughts</h3>
<p><strong>Safari on iOS 6 is a big step for HTML5 developers</strong>; debugging tools, new APIs, better JavaScript performance. However, I must say that Apple is still forgetting about documentation updates and properly communication with web developers. There are almost no answers on the discussion forum, no updates on the Safari documentation (some docs are really too old right now).</p>
<p><strong> I believe Apple must do a better job supporting web developers. </strong></p>
<p>Did you find any other new stuff? other problem or bug? Anything else you were waiting for? Feel free to comment in the section below or contact me by <a href="http://www.twitter.com/firt" target="_blank">twitter</a>.</p>
<div></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers/feed</wfw:commentRss>
		<slash:comments>142</slash:comments>
		</item>
		<item>
		<title>Chrome for iOS and Android 4.1 Jelly Bean HTML5 development</title>
		<link>http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5</link>
		<comments>http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5#comments</comments>
		<pubDate>Fri, 29 Jun 2012 00:40:22 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[ios]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=160</guid>
		<description><![CDATA[Tweet I&#8217;m attending Google I/O in San Francisco this week and Google has released some news on Chrome: an iOS version that it may not be Chrome, the Android version out of beta, now being the default browser on Android 4.1 and some other stuff. Let&#8217;s review the news in the mobile web world. &#160; [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Chrome for iOS and Android 4.1 Jelly Bean HTML5 development - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/chrome.jpg"><img class="alignleft  wp-image-161" style="margin-right: 5px;" title="chrome" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/chrome-150x150.jpg" alt="" width="90" height="90" /></a>I&#8217;m attending Google I/O in San Francisco this week and Google has released some news on Chrome: an iOS version that it may not be Chrome, the Android version out of beta, now being the default browser on Android 4.1 and some other stuff. Let&#8217;s review the news in the mobile web world.</p>
<p>&nbsp;</p>
<p><span id="more-160"></span></p>
<h3>Android 4.1 Jelly Bean browser</h3>
<p>Let&#8217;s start with <strong>Android 4.1 Jelly Bean</strong>. You know I was really happy when <a href="http://www.mobilexweb.com/blog/google-chrome-android-html5" target="_blank">Google released Chrome Beta for Android</a>. The default browser (known as Android Browser) is not good enough compared to other modern browsers and Chrome is here to solve this problem.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/android-jelly-bean.jpg"><img class="alignright size-thumbnail wp-image-162" title="android-jelly-bean" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/android-jelly-bean-150x150.jpg" alt="" width="150" height="150" /></a>First news, <strong><a href="https://www.google.com/intl/en/chrome/browser/mobile/index.html" target="_blank">Google Chrome for Android</a> is out of beta</strong> and current version is 18. This version doesn&#8217;t support new stuff from the previous beta version but it&#8217;s pretty updated in terms of HTML5 compatibility.</p>
<p>The tablet <strong>Nexus 7</strong>, the first new device with Android 4.1 has <strong>Google Chrome by default</strong>. That means that <strong>the end of the Android Browser era has started</strong>. Galaxy Nexus smartphone (at least the version I&#8217;ve received in Google I/O) still has Android Browser with Jelly Bean and you need to download Chrome from the Google Play store.</p>
<p>I could confirm with the Chrome team that most new future devices with 4.1 will have Chrome by default and Android Browser is not going to be there.</p>
<p>However, for web views –such as pseudo browser or native apps- the old engine is still there, so there is no Chrome engine from web views yet.</p>
<p>Besides that we are going to see a browser fragmentation in 4.1. New devices sold from now on and 4.0 devices that are going to be upgraded to 4.1. These 4.0 devices will still have the Android Browser as the default browser.</p>
<p>In terms of HTML5 or new compatibility, the default engine on 4.1 (for web views and upgradable devices) is still the non-Chrome one.</p>
<h3>Chrome for iOS -iPhone and iPad-</h3>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios4.jpg"><img class="alignnone  wp-image-165" title="ios4" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios4.jpg" alt="" width="100%" /></a></p>
<p>Well… this is <strong>big for mobile web development</strong>. But it&#8217;s not big because of what you are thinking. It&#8217;s big because we are going to start big philosophical discussions. That&#8217;s is because <strong><a href="https://www.google.com/intl/en/chrome/browser/mobile/ios.html" target="_blank">Chrome for iOS</a> is not Chrome.</strong> What?? It has a Chrome-style UI, onmibox, search by voice and it has Chrome synching. However, the rendering and execution engine are not Chrome.</p>
<p>I called them <strong>pseudo-browsers</strong> and you can see my opinion and a good discussion on the comments area in my <a href="http://www.mobilexweb.com/blog/axis-opera-mini-alternative-browsers-iphone-ipad" target="_blank">previous post</a>. So Chrome for iOS is in fact using the iOS Web View that share most of the code with Safari.</p>
<p>The User Agent that Chrome for iOS is using is the Safari one with one addition: &#8220;<strong>CriOS</strong>&#8221; (Chrome for iOS I guess). There is no &#8220;Chrome&#8221; word inside the User Agent, so if you are doing something special for Chrome, you are safe and it&#8217;s not going to be executed on Chrome on iOS.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/user-agent.png"><img class="alignnone  wp-image-164" title="user-agent" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/user-agent.png" alt="" width="100%" /></a></p>
<p>That means that when using <strong>Chrome for iOS you are seeing the web in the same way as in Safari</strong>. Since both are based on WebKit it seems it&#8217;s not a big deal, but it something that you should aware of. My list of things that you need to care about is:</p>
<ul>
<li><strong>HTML5 Compatibility</strong>: There are differences between <a href="http://www.mobilehtml5.org" target="_blank">Safari on iOS and Chrome for Android</a>. Chrome for iOS follows Safari on iOS, so you don&#8217;t have IndexedDB, file upload and HTML media capture, animation timing API, full screen API, remote debugging and other stuff. While some new stuff may be included in iOS 6 Google is not in control of Chrome on iOS.</li>
<li>On some APIs –such as <strong>Geolocation</strong>- it seems there is no permission per site.</li>
<li><strong>Local Storage</strong>: There are some problems on using Local Storage. Chrome is replacing the default UIWebView localstorage but the Incognito mode is called Incognito* mode (with a star) meaning that local storage is not secure.</li>
<li><strong>JavaScript on Web View are not being accelerated</strong> (Nitro engine on iOS) – that means that your code is 2.5x slower than on Safari for iOS. If you are under NDA on Apple you can <a href="http://www.mobilexweb.com/blog/ios-6-beta-1-html5-native" target="_blank">check the data for iOS 6.</a></li>
<li><strong>Full screen apps</strong>: There is no way to work with full-screen apps on Chrome on iOS so you need to remove all the invitation messages.</li>
<li><strong>No default browser</strong>: There is no way on iOS to use Chrome as the default browser so every time you click a link on Twitter, Facebook or any other native app on iOS you will be forwarded to Safari. You need to copy and paste the URL in Chrome.</li>
<li><strong>iOS versions</strong>: The same Chrome version will have different support on each iOS version where it&#8217;s relying on, such as 4.3, 5.0, 5.1 or 6.0.</li>
</ul>
<p>I&#8217;ve checked into the DOM and nothing new is being implemented. There are a couple of private objects, such as <em>__gChrome</em> that seems to be some JavaScript that Chrome is injecting on the DOM to enhance the web view experience. I&#8217;m not sure (neither the Chrome guys here at I/O) when Google is injecting this JavaScript code.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios5.png"><img class="alignnone  wp-image-166" title="ios5" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios5.png" alt="" width="100%" /></a></p>
<p>My feelings about Chrome for iOS are strange. I understand why they took the decision but it seems a very different decision that Mozilla took, such as creating <a href="http://itunes.apple.com/us/app/firefox-home/id380366933?mt=8" target="_blank">Firefox Home app</a> the the Mozilla Junior project, two apps for iOS that because of the limitations of the platform are not being called Firefox.</p>
<p><a href="http://itunes.apple.com/us/app/chrome/id535886823?ls=1&amp;mt=8" target="_blank">Chrome for iOS</a> is available for iOS 4.3 and later, it claims to be Chrome 19 and you can download from free from AppStore using this link.</p>
<h3>Chrome Apps on Android?</h3>
<p>On today&#8217;s keynote, an idea was presented: running <strong>Chrome HTML5 apps across all the devices</strong>, desktop, tablet and smartphones… so I&#8217;m waiting for a future version of Chrome for Android supporting Chrome Apps that will make a big step forward mobile HTML5.</p>
<p>The new Chrome Apps platform was presented today and everybody is saying that mobile devices will support these APIs but no information on when or how will they work yet. I&#8217;ve asked Google&#8217;s guys and the answer is: we are going to get to that point anytime in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>iOS 6 Beta 1: HTML5 new APIs, Remote Debugging and native apps integration</title>
		<link>http://www.mobilexweb.com/blog/ios-6-beta-1-html5-native</link>
		<comments>http://www.mobilexweb.com/blog/ios-6-beta-1-html5-native#comments</comments>
		<pubDate>Tue, 12 Jun 2012 19:12:55 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[ios6]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=154</guid>
		<description><![CDATA[Tweet In this post I&#8217;m analyzing the public information for developers behind Safari on iOS 6 and the research results on Beta 1 version of the next main version of the operating system for iPhone and iPad. UPDATE: This post was replaced with the final version of iOS6 available. Read it here iOS 6 for [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="iOS 6 Beta 1: HTML5 new APIs, Remote Debugging and native apps integration - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/ios-6-beta-1-html5-native"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios61.png"><img class="alignleft  wp-image-155" style="margin-right: 5px;" title="ios61" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios61-300x103.png" alt="" width="180" height="62" /></a>In this post I&#8217;m analyzing the public information for developers behind Safari on iOS 6 and the research results on Beta 1 version of the next main version of the operating system for iPhone and iPad.</p>
<p><span id="more-154"></span></p>
<div style="background: #E8E799; padding: 10px; border: 1px solid silver; font-size: x-large;">UPDATE: This post was replaced with the final version of iOS6 available.</p>
<p><a href="http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers">Read it here</a></div>
<p>iOS 6 for iPhone, iPod touch and iPad was announced on June 11 2012, and some new Safari features were publicly shown. <strong>Apple claims to have 2/3 of the mobile web browsing market</strong> (is Opera being considered?) so it&#8217;s always important for us when Safari has a new version.</p>
<p>iOS 6 will be available for iPhone 3GS, 4 and 4S, iPod Touch 4<sup>th</sup> generation and iPad 2<sup>nd</sup> and 3<sup>rd</sup> generation.</p>
<p>That means: <strong>iPad fragmentation has started</strong>.</p>
<p>&nbsp;</p>
<h2>Public new features for Safari on iOS 6</h2>
<h3>File uploads</h3>
<p>Finally! We can now select an image from the Photo Library or opening the Camera from a web form. The question is about HTML Media Capture being implemented or not (see later for the answer).</p>
<h3>Web Audio API</h3>
<p>With the <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html" target="_blank">Web Audio API</a> we can enhance HTML5 games and multimedia apps with mixing, filtering and processing operations through JavaScript.</p>
<h3>CSS Filters</h3>
<p><a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html" target="_blank">CSS 3 Filters</a> a set of image operations (filters) that we can apply using CSS functions, such as grayscale, blur, drop-shadow, brightness and other effects. These functions will be applied before the content is rendered on screen. We can use multiple filters using spaces (similar to transforms).</p>
<h3>Smart App Banners</h3>
<p><img class="size-medium wp-image-156 alignnone" title="smart apps" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/smart-apps-300x199.png" alt="" width="300" height="199" /></p>
<p>It&#8217;s a way to connect websites to native applications. When you browse a web that has a related native application, Safari can show a banner inviting the user to install or open the native app. The website can also send parameters to the native app. It&#8217;s not clear how this is going to be implemented. My guess is through meta tags. The same behavior is available on <a href="http://blogs.msdn.com/b/ie/archive/2011/10/20/connect-your-web-site-to-your-windows-8-app.aspx" target="_blank">Internet Explorer 10 for Windows 8</a>.</p>
<h3>Full Screen support on landscape</h3>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios62.png"><img class="alignnone size-medium wp-image-157" title="ios62" src="http://www.mobilexweb.com/wp-content/uploads/2012/06/ios62-300x154.png" alt="" width="300" height="154" /></a></p>
<p>When you orient your device in landscape mode you can then move to a full-screen mode, including hiding the status bar and the Safari toolbar at the bottom. Transparent buttons are replacing the toolbar. A similar behavior is available on Nokia Browser for Symbian.  It&#8217;s not clear at this point if we can use the FullScreen API to request the feature (see later for the answer)</p>
<h3>Remote Web Inspector</h3>
<p>This is a big feature. Announced as a very small feature in the new APIs for developers. In the keynote there was no other information. As you may know, I&#8217;ve developed <a href="http://www.iwebinspector.com" target="_blank">iWebInspector for iOS 5</a> because of the lack (or the hiding) of a web inspector tool for debugging web apps. It&#8217;s not public if this new Remote Web Inspector through LAN (like BlackBerry Remote Web Inspector) or through USB (like Google Chrome for Android)… the answer, later in this post.</p>
<h3>Crossfade CSS Function</h3>
<p>This feature was published in the keynote with &#8220;font-face: 3px&#8221; but I&#8217;ve seen it. It&#8217;s an image function that will create a crossfade between two images (<a href="http://www.w3.org/TR/2011/WD-css3-images-20110217/#cross-fade-function" target="_blank">Spec draft</a>), for example:</p>
<p><code>background-image: -webkit-cross-fade(url("image1.png"),  url("image2.png"), 40%);</code></p>
<p>Will it work with transitions?</p>
<p>&nbsp;</p>
<h2>Other announced features and questions</h2>
<h3>iCloud Tabs</h3>
<p>You can synchronize your tabs between all your devices, including Macs, iPhones and iPads. So the same URL will be distributed through all devices. Be careful on your mobile web architecture!</p>
<h3>Offline Reading List</h3>
<p>when the user adds a page to the reading list it will be also downloaded and precache. Is there any API to know if our page is being executed from the cache?</p>
<h3>Maps</h3>
<p>Google Maps native app was replaced by a new Maps app (directly from Apple). The question is, is this app still capturing http://maps.google.com URLs? (I hope not) and how to open the native app or driving instructions from a web.</p>
<h3>Twitter and Facebook</h3>
<p>Both social networks are not integrated in the operating system. It will be good if at some point web apps can also use these credentials.</p>
<h3>Questions from the past</h3>
<p>WebGL? IndexedDB? getUserMedia (camera access)? Nitro engine on Web Views?</p>
<p>&nbsp;</p>
<h2>Other news on HTML5 APIs inside the iOS 6 beta 1</h2>
<p>I&#8217;ve been playing with Safari on iOS 6 Beta 1 for a couple of hours and I&#8217;ve found other features and answers to my questions. However, <strong>iOS 6 Beta 1 is under NDA</strong> (Non Disclosure Agreement) so I can&#8217;t talk about it in public. (Apple it&#8217;s time to release web-related technologies out of the NDA). I can just say that my findings are at least the double of the information I&#8217;m posting here.</p>
<p>If you are enrolled in the <strong>iOS Developer Program</strong>, you can see the <a href="https://devforums.apple.com/thread/153871" target="_blank">rest of this article under NDA</a>.</p>
<h4><span style="color: #ff0000;"><a href="https://devforums.apple.com/thread/153871" target="_blank"><span style="color: #ff0000;">Continue this article under NDA &gt;&gt;</span></a></span></h4>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/ios-6-beta-1-html5-native/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Axis, Opera Mini, pseudo-browsers and alternatives to Safari on iOS</title>
		<link>http://www.mobilexweb.com/blog/axis-opera-mini-alternative-browsers-iphone-ipad</link>
		<comments>http://www.mobilexweb.com/blog/axis-opera-mini-alternative-browsers-iphone-ipad#comments</comments>
		<pubDate>Fri, 25 May 2012 21:56:28 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[pseudobrowsers]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=147</guid>
		<description><![CDATA[Tweet Yahoo! has just released the new Axis app for iOS and desktop, promoted on some blogs as a new browser. It&#8217;s a good opportunity then to explain how this kind of apps work and why they are NOT browsers. If you are a web developer it&#8217;s important for you to know what to expect [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="Axis, Opera Mini, pseudo-browsers and alternatives to Safari on iOS - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/axis-opera-mini-alternative-browsers-iphone-ipad"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/05/mza_7618881823748171282.175x175-75.jpg"><img class="alignleft  wp-image-148" style="margin-left: 5px; margin-right: 5px;" title="mza_7618881823748171282.175x175-75" src="http://www.mobilexweb.com/wp-content/uploads/2012/05/mza_7618881823748171282.175x175-75-150x150.jpg" alt="" width="80" height="80" /></a>Yahoo! has just released the new <strong><a href="http://axis.yahoo.com" target="_blank">Axis app for iOS</a></strong> and desktop, promoted on some blogs as a new browser. It&#8217;s a good opportunity then to explain how this kind of apps work and <strong>why they are NOT browsers</strong>. If you are a web developer it&#8217;s important for you to know what to expect for this app.</p>
<p><span id="more-147"></span></p>
<h3>Pseudo-browsers</h3>
<p>I know but at some point it&#8217;s a matter of semantics. I like to call this apps <strong>pseudo-browsers:</strong> they pretend to be browsers.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/05/photo.png"><img class="alignright" style="margin-left: 5px; border: 1px solid black;" title="photo" src="http://www.mobilexweb.com/wp-content/uploads/2012/05/photo-200x300.png" alt="" width="200" height="300" /></a>If you have an iOS or Android device and you&#8217;ve used <strong>Twitter</strong> or <strong>Facebook</strong> you&#8217;ve already deal with the idea. When you open a link on those social networks you get an embedded browser and it&#8217;s basically using the UIWebView component on iOS and the WebView on Android (image at the right).</p>
<p>You are right. It&#8217;s the same component that is the base of native web apps –such as PhoneGap apps-. <strong>It&#8217;s not 100% the default browser embedded on an app, but it&#8217;s quite similar.</strong> Basically, both the default browsers (Safari and Android Browser) uses at some point the same code as the web views. However, browsers and web views have also differences in behavior, such as JavaScript execution engines or other HTML5 APIs.</p>
<p>On iOS –that&#8217;s for iPhone and iPad-, Yahoo! Axis, iCab Mobile, Skyfire, Dolphin, Mercury Web Browser, and other dozen of apps on the AppStore are not browsers, just apps using the default web view adding different behaviors on the UI, on the search mechanism or sharing features than the default Safari.</p>
<p>For a web developer or designer, <strong>it&#8217;s the same as the web view</strong>. That means that there is no new or removed API than what you can find using the default rendering engine. They are not really adding fragmentation to the mobile web world.</p>
<h3>What about Android browsers?</h3>
<p>On the Android side we do have different real browsers, such as Firefox or Opera Mobile with real different rendering and execution engines. And we have also some other pseudo-browsers available for download.</p>
<h3>Why can&#8217;t we find real browsers on the AppStore for iOS?</h3>
<p>Because of <a href="https://developer.apple.com/appstore/guidelines.html" target="_blank">Apple Review Guidelines</a> saying that any application with web content MUST use the default-rendering engine for HTML, CSS and the default execution engine for JavaScript.</p>
<h3>What&#8217;s the deal with <a href="http://itunes.apple.com/us/app/opera-mini-web-browser/id363729560?mt=8" target="_blank">Opera Mini for iOS</a>?</h3>
<p><img class="alignright size-medium wp-image-150" title="opera-mini-steve-jobs-2" src="http://www.mobilexweb.com/wp-content/uploads/2012/05/opera-mini-steve-jobs-2-300x216.jpg" alt="" width="300" height="216" /></p>
<p>As you know, Opera has its own rendering engine. Well, Opera Mini, Puffin, iSwifter and other browsers, are cloud-based browsers. That means that your code is not being executed on the device but on a <strong>proxy server.</strong> There is no rendering or execution engine on the iOS so for Apple, the app is not using a different engine on the device.</p>
<p>Opera Mini had troubles to get accepted at the beginning (look at the joke for Steve Jobs Opera did on Mobile World Congress 2010), but finally Apple flexibilized the rule and accepted it and other cloud-based browsers.</p>
<h3>Back again to the problem</h3>
<p><strong>Now you understand why there is no Firefox for iOS.</strong></p>
<p><strong>Now you understand why Axis is not a web browser.</strong></p>
<p>Axis may be a tool to browse the web in a different way, but you are browsing the web with a –let me take a break and say- <strong>embedded Safari</strong>. If your website is being browsed by Axis it&#8217;s the same as in the Twitter, Facebook or Flipboard. You can expect mostly all the API support from Safari with an slower JavaScript engine –no Nitro for web view available- and some different behavior on HTML5 APIs.</p>
<p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/05/axi.png"><img class="size-full wp-image-151 alignnone" title="axi" src="http://www.mobilexweb.com/wp-content/uploads/2012/05/axi.png" alt="" width="500" height="369" /></a></p>
<p>Some guys were discussing on Twitter that you can say that Google Chrome is not a browser because it&#8217;s based on WebKit. Well, wrong! &#8220;Based on&#8221; doesn&#8217;t mean &#8220;using&#8221;. Chrome is compiling WebKit with additions and removed features, so for developers it&#8217;s really a new browser –it has different behavior, and we know that. You can compile your own WebKit flavor on iOS but you will never be accepted on the AppStore -at least with current rules.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/axis-opera-mini-alternative-browsers-iphone-ipad/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>What iOS 5.1 and the new iPad mean for web developers</title>
		<link>http://www.mobilexweb.com/blog/ios-5-1-new-ipad-web-developers</link>
		<comments>http://www.mobilexweb.com/blog/ios-5-1-new-ipad-web-developers#comments</comments>
		<pubDate>Fri, 09 Mar 2012 15:54:50 +0000</pubDate>
		<dc:creator>firt</dc:creator>
				<category><![CDATA[New devices and browsers]]></category>
		<category><![CDATA[ios safari ipad]]></category>

		<guid isPermaLink="false">http://www.mobilexweb.com/?p=141</guid>
		<description><![CDATA[Tweet The new iPad is here with iOS 5.1. I&#8217;ve done the usual research and, mm&#8230; there are no much new details to give you. However, the new iPad retina display remembers us some web stuff we should be aware of while creating iPad web experiences. Safari on iOS 5 and Safari on iOS 5.1 [...]]]></description>
				<content:encoded><![CDATA[
	<div style="float: right; margin: 10px">
		<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="What iOS 5.1 and the new iPad mean for web developers - Breaking the Mobile Web" data-url="http://www.mobilexweb.com/blog/ios-5-1-new-ipad-web-developers"  data-via="mobilexweb @firt" data-related="firt:Blog\\\\\\\\\\\\\\\'s author">Tweet</a>
	</div>
	<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p><a href="http://www.mobilexweb.com/wp-content/uploads/2012/03/newipad.png"><img class="alignleft size-full wp-image-142" style="margin-left: 10px; margin-right: 10px;" title="newipad" src="http://www.mobilexweb.com/wp-content/uploads/2012/03/newipad.png" alt="" width="72" height="57" /></a>The new iPad is here with iOS 5.1. I&#8217;ve done the usual research and, mm&#8230; there are no much new details to give you. However, the new iPad retina display remembers us some web stuff we should be aware of while creating iPad web experiences.</p>
<p><span id="more-141"></span></p>
<p>Safari on iOS 5 and Safari on iOS 5.1 seems to be exactly the same. There is no new APIs, no new stuff supported, same WebKit version; only we have the version change on the User Agent.</p>
<p>However, iOS 5.1 is the first version supporting <strong>high resolution iPads</strong>. While there is no real devices yet to test on, there are some ideas we need to remember from the iPhone 4 high definition launch and everything goes in the same direction.</p>
<h3>Too many pixels</h3>
<p>The iPad has a resolution of <strong>2048 x 1536</strong>. It&#8217;s far away more pixels than we use to have on the web.</p>
<p><strong>Do we need to change our websites for this new resolution?</strong> Well, definitely no.</p>
<p>First, remember that <strong>more pixels doesn&#8217;t mean more visual space to use</strong>. Your website will be rendered as in iPad 1 and iPad 2 with the advantage of sharpen text, CSS3 effects and gradients.</p>
<p>We need to remember that since the appearance of iPhone 4 -and also followed by Android- mobile browsers are exposing a virtual resolution to web developers based on the viewport meta tag and/or an attribute called <strong>Pixel Ratio</strong>. iPad 1 and iPad 2 have a Pixel Ratio of 1. The new iPad has a Pixel Ratio of 2. This value can be accessed though JavaScript using <em>window</em>.<em>webkitPixelRatio </em>or though CSS media queries using <em>-<em>webkit</em>-device-<em>pixel</em>-<em>ratio. </em></em></p>
<p>If we define a div of 500 pixels-wide, it will be really 500 pixels-wide on iPad and 1,000 pixels-wide on the new iPad, unless an special viewport is defined.</p>
<h3>High resolution images</h3>
<p>Now we know that we will not have problem with text and CSS3 effects. Images is a very different problem. Basically, the new iPad will resize your image. At the end you will not see much difference from iPad 1 or iPad 2. However, if you provide a high resolution alternative the image will become more clear. You can provide alternative images using the Device Pixel Ratio attribute. In case of CSS3, the code should look like:</p>
<p><code> @media (-webkit-device-pixel-ratio: 2) {<br />
#someContainer {<br />
background-image: url('images-hi/image.png');<br />
}<br />
}<br />
</code></p>
<h3>Icons and launch images</h3>
<div> For WebClip icons -those that iOS uses when the user adds our website to the Home Screen- we can leave the current iPad icon -72&#215;72 pixels- or we can provide a high resolution version -<strong>144&#215;144 pixeles</strong>- using the same code:</div>
<div>
<p><code> &lt;link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad-lo.png" /&gt;<br />
&lt;link rel="apple-touch-icon" sizes="144x144" href="touch-icon-ipad-hi.png" /&gt;<br />
</code></p>
</div>
<div>If you are creating a chromeless app then you may know about apple-touch-startup-image link element. There is no official way to define different sizes on this element. However, a trick using media queries is working for delivering landscape and portrait versions right now so it&#8217;s possible to have this working for high resolution images too.</div>
<h3>Performance</h3>
<p>Wait before looking for high resolution versions of your images. If we think about it, we need an image with four times pixels. That&#8217;s a huge difference and the image size will be much higher. What does this mean? Your page will be much slower. Ok, there is a 4G version of the new iPad but that doesn&#8217;t mean that the difference will be covered.</p>
<p><strong>Think twice about the value added when delivering high resolution images</strong>.</p>
<p>Creating effects and gradients using CSS3 will be much faster. However, large backgrounds tends to use lot of memory. Fortunately, the new iPad comes with more memory and CPU power so hopefully this won&#8217;t be a problem.</p>
<p>Maybe it&#8217;s time to start looking at scalable solution, such as SVG that will take advantage of the high resolution without harming network performance.</p>
<p>In terms of HTML5 games, we need to wait until having the real device but usually if you want to increase your frame rate sometimes it&#8217;s better to provide a smaller viewport, so the game will use less memory -like a iPad 2 emulator- and using hardware accelerated CSS3 transforms we can scale it if we need to. It&#8217;s just a thought and a trick that is being used in some Android HTML5 games to gain some frames per seconds.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mobilexweb.com/blog/ios-5-1-new-ipad-web-developers/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
