MG Siegler, TechCrunch - http://techcrunch.com/2011/02/09/html5-versus-native-apps/</li></ul>“…the fact that very few [developers], if any, choose to go HTML5-only is telling…” - Siegler<br /><ul><li>Some think that HTML5 is the way to go
John Ciancutti, VP of Personalization Technology, Netflix - Why We Choose HTML5 for User Experiences on Devices</li></ul>“Our customers don’t have to go through a manual process to install new software every time we make a change, it ‘just happens.’” - Ciancutti<br />
Hybrid App Strategy<br /><ul><li>With a hybrid app you are free to implement whatever works best
In the end…<br /><ul><li>You want to spend your time building cool stuff, not reinventing the wheel for each platform (hello “Owl Cam”)</li></li></ul><li>How do we know where we are?<br /><ul><li>Is the web site page view from a mobile web browser or app?
Android – Allows you to change your user agent
iOS – Does not allow you to change your user agent
But wait! In iOS the webView does have a different user agent than mobile safari.
Doh… what if another hybrid app looks at your web page?
Best solution we have found for iOS? A cookie (who doesn’t love a cookie?)
Set the cookie on the web view every time the app opens
Then there is Windows Phone 7 – doesn’t allow you to set a cookie natively on the web view
But we can set it server side…</li></li></ul><li>Hybrid Technique #1: URL Modification<br /><ul><li>If you know you are serving a web page inside your hybrid app you can send modified URLs to perform native actions
Facebook does (did?) this in their iOS API with a return to their own fake protocol: fb://do-something-useful</li></li></ul><li>Hybrid Technique #2: URL Interception<br /><ul><li>From within your native app most web views allow you to listen for a change to the URL
Instead we navigate the web view to a URL with dummy values which gets intercepted by the native wrapper</li></ul>http://www.tripadvisor.com?latitude=LAT&longitude=LNG<br />turns into<br />http://www.tripadvisor.com?latitude=42.313156&longitude=-71.21274<br />
Hybrid Technique #2: URL Interception (contd.)<br /><ul><li>As an added benefit you can include a link on both the web page and native app that gets intercepted.
On page load pull out the data with the native wrapper and put it to good use</li></ul>Pin data gets pulled out and rendered natively<br />WebView loads and contains location pin data in a JS variable<br />