390 likes | 582 Views
2-015 WP8 HTML5/IE10 for Developers. Jorge Peraza & Rick Xu Program Managers Session 2-015. Demo Search & Pulse. What are we going to talk about?. Why choose HTML5? What exactly is an HTML5 app on Windows Phone? How can I build one? Can I integrate it deeply into the platform?.
E N D
2-015 WP8 HTML5/IE10 for Developers Jorge Peraza & Rick Xu Program Managers Session 2-015
What are we going to talk about? • Why choose HTML5? • What exactly is an HTML5 app on Windows Phone? • How can I build one? • Can I integrate it deeply into the platform?
No, but really, with HTML5 you can… • Reuse your existing HTML, CSS and JavaScript skills • Reduce development costs by leveraging investments across different platforms • Can be combined with C# to gain access to the rest of the platform capabilities
And momentum keeps building IDC - http://www.idc.com/getdoc.jsp?containerId=prUS23480612 1 Billion mobile devices with modern browsers in 2013 2 Million Web developers in 2013 79% of Mobile app developers are exploring HTML5 80% of Mobile Apps will use HTML5 by 2015
What exactly is an HTML5 app on WP8? • Windows Phone App that leverages the WebBrowser control for some or all of its functionality
All great things start from the beginning • Building our first HTML5 app
Internet Explorer 10 • Hardware accelerated • Built for touch • Fast even for apps! • Offline apps are a go!
IE10 hardware-accelerated web platform CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Backgrounds & Borders CSS Color CSS Device Adaptation* CSS Flexbox* CSS Fonts CSS Grid* CSS Image Values (Gradients) CSS Media Queries CSS Multi-Column Layout* CSS Namespaces CSS OM Views CSS Regions And Exclusions* CSS Selectors CSS Transitions CSS Values And Units Data URI DOM Element Traversal DOM HTML DOM Level 3 Core DOM Level 3 Events DOM Style DOM Traversal And Range DOMParser And XMLSerializer ECMAScript 5 Formdata HTML5 Application Cache HTML5 Async Scripts HTML5 BlobBuilder HTML5 Canvas HTML5 Drag And Drop HTML5 Forms And Validation HTML5 Geolocation HTML5 History API HTML5 Parser HTML5 Sandbox HTML5 Selection HTML5 Semantic Elements HTML5 Video And Audio JavaScript Typed Array ICC Color Profiles IndexedDB Page Visibility Pointer (Mouse, Pen, And Touch) Events* RequestAnimationFrame Navigation Timing Selectors API Level 2 SVG Filter Effects SVG, Standalone And In HTML Web Messaging Web Sockets Web Workers XHTML/XML XHR (Level 2) XHR CORS
CSS3 Effects • 2D & 3D Transforms • Transitions • Animations • Shadows • Gradients • Custom Fonts
Demo • Adding a live tile to our app
Touch events Built on top of the MSPointer model Follow the familiar pattern of DOM mouse events Supports multiple touch points Requires only a few changes to existing touch sites
Gesture events Easy to capture gestures over a single or multiple elements on the DOM Recognizes pan and pinch with inertia! Gives developers access to the Windows Phone 8 “touch language” Allows multiple gestures to be recognized concurrently
Demo • Adding touch support to our app
CSS3 for content flow • Multiple Columns • Positioned floats • Regions • Grids • Flexbox
Demo • Using Flex-box to create a HTML5 start-like experience
Layout Viewport Width Layout Viewport Height Visual Viewport
Sizing your viewport • <META name=“viewport”/> • @-ms-viewport • Defines the initial size of the layout viewport in CSS pixels • Beware of using device-width and be prepared to adapt your layout… RWD Anyone?
A word on fixed positioned elements • position:fixed • Fixed positioned elements are positioned relative to the layout viewport
Demo • Adding device adaptation support for our app
Other helpful HTML5 features • App cache • IndexedDB • History • WebWorkers • WebSockets
In a perfect world • All I would need is HTML5…
When we need more, XAML to the rescue! • Use InvokeScript to call JavaScript functions from host (C#) • webBrowser.InvokeScript(“myFunction", “myArg1”); • webBrowser.InvokeScript(“eval”, “document.body.offsetHeight.toString()”); • webBrowser.InvokeScript(“execScript”, myScript.ToString()); • Use ScriptNotify to call host (C#) from JavaScript async • XAML: <WebBrowserScriptNotify=“Browser_ScriptNotify” /> • JavaScript: window.external.notify(parameter); • C#: private void Browser_ScriptNotify(object sender, NotifyEventArgs e) // use e.value to retrieve parameter
But wait, there is more! • Set the default background color • webBrowser.Background=“#ffff00”; • Easily navigate backward/forward • if (webBrowser.CanNavigateBack) webBrowser.GoBack(); • if (webBrowser.CanNavigateForward) webBrowser.GoForward(); • Clear local cache and cookies • await webBrowser.ClearCookiesAsync(); • await webBrowser.ClearInternetCacheAsync(); • Load files directly from XAP • webBrowser.Navigate(new Uri("test.html", UriKind.Relative))
Provides a cross platform, rapid and cost effective way to buildbeautifulapps that are delightfulto use and interact with and immersepeople to get the most out of their content while feeling native and integratedwith Windows Phone. Window Phone 8 web platform
Call to action • Download the WP8 Developer tools! • Try the new HTML5 Application template! • Build great Apps!
RESOURCES • Resource Listhttp://wpdev.ms/phonedevres • Certification Requirementshttp://wpdev.ms/certreq • “How To” Indexhttp://wpdev.ms/howtos • Official Sampleshttp://wpdev.ms/officialsamples • Forumshttp://wpdev.ms/ahforum • Supporthttp://wpdev.ms/devsupport • JW on Metro Design for Devshttp://wpdev.ms/thejeffonmetro
MIDDLEWARE • Windows Phone Toolkithttp://silverlight.codeplex.com • Little Watson, (in Northern Lights toolkit)http://northernlights.codeplex.com • Tombstone Helperhttp://tombstonehelper.codeplex.com • Your Last About Dialoghttp://ylad.codeplex.com • Notify Property Weaverhttp://visualstudiogallery.msdn.microsoft.com/bd351303-db8c-4771-9b22-5e51524fccd3 • Coding 4 Fun Toolkithttp://coding4fun.codeplex.com • WP App Site Templatehttp://wp7appsite.codeplex.com
COMMUNITY • User Voicehttp://wpdev.uservoice.com • Twitter - #WPDEVhttps://twitter.com/#!/search/%23wpdev