windows 8 & javascript

25
Building Windows 8 applications with JavaScript JavaScript by Robert MacLean

Upload: robert-maclean

Post on 20-Nov-2014

4.711 views

Category:

Technology


0 download

DESCRIPTION

Slides from my talk at JSinSA - the first part (all lolcat

TRANSCRIPT

Page 1: Windows 8 & JavaScript

Building Windows 8 applications with JavaScript

♥ JavaScript

by Robert MacLean

Page 2: Windows 8 & JavaScript

Hi

Page 3: Windows 8 & JavaScript

Today

Tomorrow

Page 4: Windows 8 & JavaScript

Windows 8?

Page 5: Windows 8 & JavaScript

Metro Design vs. Metro Apps

Page 6: Windows 8 & JavaScript

Why a Metro App?

Page 7: Windows 8 & JavaScript

Browsers in Windows 8

Page 8: Windows 8 & JavaScript

Marketplace

Page 9: Windows 8 & JavaScript

Windows Runtime

Page 10: Windows 8 & JavaScript

WinJS

Page 11: Windows 8 & JavaScript

Your tools & knowledge

Page 12: Windows 8 & JavaScript

Summary

Windows 8 is coming

Modern way for users to work, modern way for developers to build

JavaScript & HTML 5 is FIRST CLASS

Questions?

Page 13: Windows 8 & JavaScript

Contact Details

Robert [email protected] 073 142 5422@rmacleanhttp://www.sadev.co.za

Page 14: Windows 8 & JavaScript

Out this year100 000 new & improved features

Big focuses on the futureConsumerisation of ITTablets

ARM support

New development options and tools

Page 15: Windows 8 & JavaScript

Metro

Metro design & “Metro apps” are differentDesign matters

Common language for designCommon UX for Microsoft

XboxWindowsWindows Phone

Not going to be covered in this talk

Page 16: Windows 8 & JavaScript

Benefits of Metro Apps

TrustSandboxedUser is in controlOpt-in for features

Take advantage of Windows RT featuresCross CPU supportBacked by the cloudEasy for users to get, install and migrate apps

MarketplaceWindows Live

Page 17: Windows 8 & JavaScript

Browsers in Windows 8

Internet Explorer 10Metro App & Traditional Desktop Application

Metro is plug in free

Expect it to be better than IE 9, in every wayMicrosoft has a new model for development

Firefox & ChromeMetro App & Traditional Desktop ApplicationMozilla & Google getting special permissions & working with Microsoft

Page 18: Windows 8 & JavaScript

Hardware Accelerated in IE 9 & IE 10

Page 19: Windows 8 & JavaScript

Marketplace

App store, like any otherProcess

SubmissionTesting & Approval by MicrosoftProfit

FreeAdvertsTrials (limited time & limited features)In App Purchases

Page 20: Windows 8 & JavaScript

Windows Runtime (WinRT)

Win32 API is twenty years oldDifferent world & different devices

WinRT built from ground upModern thinking, “stolen” from best of breed

MobileAsync.NET & Java

All languages are first class

Page 21: Windows 8 & JavaScript

WinJS

Project the Windows Runtime into JavaScriptWinJS – implemented as

Core library UI libraryResource librariesStyle sheets

Not portable, even to Windows 8 browsersProjectable to Windows Metadata

Can be consumed in other languages

Page 22: Windows 8 & JavaScript

Your favourite libraries

This is real JavaScriptYour patterns move acrossYour libraries move across

Be careful of cross domain checksSome additional securitySee hidden slides

Page 23: Windows 8 & JavaScript

jQuery, XHR and local context

• jQuery xhr does a cross-domain check (in > v1.6)– In local context, your origin is

“ms-wwa://{something}”– Cross domain check fails

• Workarounds– Use WinJS XHR– Tell jQuery to bypass the check

• $.support.cors = true;• http://api.jquery.com/jQuery.support/

Page 24: Windows 8 & JavaScript

Host Enforcement

• Prevents potentially “bad” HTML from getting inserted– Script blocks, iframes, event handlers, etc.

• Kicks in when setting strings– innerHTML– outerHTML– setAdjacentHTML

• “data-” attributes in general not on the allowed list– WinJS specific ones are ok

Page 25: Windows 8 & JavaScript

Host Enforcement Escape Hatches

• Can work around when needed:– toStaticHTML method– Use DOM creation APIs– Use WinJS.Utilities.setInnerHTMLUnsafe – Use msWWA.execUnsafeLocalFunction

Do a security review if you bypass host enforcement!