The document compares various features of HTML5 and Silverlight, including platforms supported, storage options, databases, offline capabilities, threading models, communication APIs, notifications, audio/video support, canvas drawing, and other miscellaneous features. Key differences discussed include HTML5's broader platform support versus Silverlight's reliance on the .NET framework and browser plugins. The document provides overviews and comparisons to help understand how the technologies compare in various areas.
10. This is not
an overview of
HTML5 Features.
http://www.w3.org/html5
http://www.html5rocks.com/
http://slides.html5rocks.com
http://diveintohtml5.org
23. Storage
Local Storage
// use localStorage for persistent storage
// use sessionStorage for per tab storage
window.localStorage.setItem('value', area.value);
window.sessionStorage.setItem('timestamp', (new Date()).getTime());
var val = window.localStorage.getItem('value');
window.localStorage.removeItem('value');
window.localStorage.clear();
25. Storage
ApplicationSettings / Site Settings
// ApplicationSettings are plugin instance specific
// SiteSettings are site (URL) specific
private IsolatedStorageSettings userSettings =
IsolatedStorageSettings.ApplicationSettings;
private IsolatedStorageSettings siteSettings =
IsolatedStorageSettings.SiteSettings;
userSettings.Add("value", "hello world");
userSettings.Remove("value");
userSettings.Clear();
26. Storage
Isolated Storage
// GetUserStoreForApplication() - plugin specific
// GetUserStoreForSite() - site (URL) specific
var isf = IsolatedStorageFile.GetUserStoreForApplication();
using (var isfs = new IsolatedStorageFileStream(fileName,
FileMode.Create, isf))
using (StreamWriter sw = new StreamWriter(isfs))
sw.Write(data);
using (var isfs = new IsolatedStorageFileStream(fileName,
FileMode.Open, isf))
using (StreamReader sr = new StreamReader(isfs))
var allData = sr.ReadToEnd();
28. Databases
Web SQL Database
var db = openDatabase('exampleDB', '1.0', 'example database', 5 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS foo (id unique, text)');
tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "bar")');
tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
var len = results.rows.length, i;
for (i = 0; i < len; i++) {
alert(results.rows.item(i).text);
}
});
});
38. Offline
Out-of-Browser (OOB)
• OOB applications run in a separate window and work
regardless of network connectivity.
• Silverlight API gives full control of installation and updates.
• Default Isolated Storage capacity increases from 5 MB to
25 MB
• Web Browser control for OOB applications
• With Elevated Trust you can call COM APIs
• Silverlight 5 introduces p/invoke, multiple windows
44. Communication
WebSocket API
var ws = new WebSocket("ws://websocket.example.com");
ws.onopen = function(e) { alert("WebSocket connection open"); };
ws.onmessage = function(e) { alert("WebSocket message received: "
+ e.data); };
ws.onclose = function(e) { alert("WebSocket connection closed"); };
ws.postMessage("Hello WebSocket");
ws.disconnect();
45. Communication
Silverlight & WCF
• Silverlight WCF client supports PollingDuplexHttpBinding
for a simulated duplex communication over HTTP
• Silverlight supports System.Net.Sockets for low level
sockets communication
• Silverlight supports UDP multicast clients over Sockets
• The only thing Silverlight doesn’t support that WebSockets
API does is secure socket communication
61. Video
MediaElement
Container Codecs
ASF WMV & VC-1
MP4 H.264
Also Supports...
• Progressive Download & Windows Media Streaming
• Server Side Play Lists
• Server Logs
• Timeline Markers
67. Potpourri
• Canvas 3D - WebGL
• SVG (inline, etc)
• Drag & Drop, Drop In, Drag Out
• File System API
• Geolocation API
• Semantic HTML Tags
• New form types (email, date, range, search, tel, color,
number)
68. Potpourri
• CSS - Selectors, Rounded Corners, Shadows, Transitions,
Tranforms, Animations, etc.
• Webfonts
• Javascript selectors (getElementsByClassName,
querySelector, querySelectorAll)
• data-* attributes
• element.classList
• Browser History API
69. Potpourri
• XAML
• Languages - C#,Visual Basic.NET, Iron Ruby, Iron Python
• 3D - Silverlight 5 Beta
• GPU Hardware Acceleration
• Devices - Webcam, Microphones
• Printing - Bitmap in SL 4, Postscript vector in SL 5
• COM Interop (Out-of-browser full trust)
• P/Invoke (Out-of-browser full trust in SL 5)
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
HTML 5 is really updated HTML, CSS, and Javascript specifications. What is considered by most people to be HTML 5 is actually several specifications that are all grouped under that name.\n
Although most features of HTML 5 will be mentioned by this presentation, I will not go in depth into any of these features. For more information, check out these links.\n
This presentation is given at .NET focused conferences so I&#x2019;m discussing Silverlight. This presentation could just as easily be called HTML5 vs Plugins or HTML5 vs Native Apps.\n
\n
\n
\n
\n
\n
Browser Percentages according to StatCounter\n
Mobile Browser Percentages according to StatCounter\n
Browser Plugins Installed according to RIA Stats\nNote that 72.68 % of browsers have Silverlight 2+ installed, while 73.37% of browsers have Canvas & Video support ... virtually the same!\n
\n
- Very simple key-value pair storage\n- jquery-jstore - jQuery based library implemented over local storage\n- 5MB limit with no API to increase quote - at the users&#x2019; mercy!\n
\n
A very simple key-value pair storage layer over Isolated Storage.\n\n
- You can write whatever you want to Isolated Storage, and its up to you to make sure you have space and whether files exist or not\n- 5MB space by default\n
\n
- this is an implementation of SQLite in javascript\n- W3C deprecated specification on 11/18/2010 which means you shouldn&#x2019;t use it :-(\n
Firefox has stated it will never add support for Web SQL. Coupled with IE&#x2019;s lack of interest, the W3C deprecated the specification.\n
- Indexed Database API, aka IndexedDB, formerly known as WebSimpleDB\n- this is an object store, not a relational database, storing Javascript Objects\n- Asynchronous and Transactional only\n- You can create indexes against your stored objects\n
- Microsoft is reportedly experimenting with the technology.\n- The best example I could find online did not work and was out of date\n- IMO, this technology shows great promise, but is not ready for prime time.\n
\n
\n
- CACHE MANIFEST section includes all resources loaded into cache\n- NETWORK section includes all resources not cached\n- FALLBACK section includes page to fall back to when offline and referencing a page that is not included in the cache\n
- The cache manifest document is referenced in whatever page you want to automatically load all resources into the local application cache.\n- This is brittle - a problem with loading any resource will cause the entire process to fail, and the error notifications are very limited.\n
- Note that onLine won&#x2019;t tell you if your site is down or not responding - only whether the browser has network connectivity.\n- IE and Firefox have &#x201C;Work Offline&#x201D; menu options, but WebKit browsers don&#x2019;t.\n
- Each browser has a different default size for the cache&#x2019;s quota, with no API for checking the quota size or increasing it defined in the specification!\n- Again, at the users&#x2019; mercy for cache size.\n- Why no IE support?\n
The concept of Silverlight OOB couldn&#x2019;t be distilled into a simple code sample, so I&#x2019;m listing main capabilities here.\n
\n
Web Workers have no access to the DOM or the calling page; the only communication allowed is through messages.\n
Web Workers have no access to the DOM or the calling page; the only communication allowed is through messages.\n
- Silverlight has the concept of the UI Thread\n- Asynchronous networking calls return on a different thread (not UI)\n- DispatcherTimer class runs your code in a different thread\n- BackgroundWorker class is preferred, although you can go old school\n
\n
WebSocket API provides bi-directional, full-duplex communication over a single TCP socket.\n
The concept of Silverlight and WCF is too much for a simple code example, so I&#x2019;ll just list the pertinent comparable features.\n
\n
\n
Supported in Chrome through the webkitNotifications property and in Firefox nightlies through the mozNotifications property. May slip to a later version in Firefox.\n
- only available out-of-browser\n- cannot receive keyboard focus or events\n- no stacking or queueing support - you have to handle that yourself\n
\n
\n
\n
Note that no single encoding works for all browsers -- you WILL end up referencing multiple encodings.\n
\n
Windows Phone 7 supports more containers and codecs.\n
\n
\n
\n
Note that no single encoding works for all browsers.\n
Bonus points if you notice that this looks just like the Audio for Silverlight.\n
I&#x2019;m no video expert but I&#x2019;m listing these features just to show that Silverlight has more video support than whats currently available in the HTML specification.\n
\n
\n
Note that Opera Mini&#x2019;s partial support - it will display the canvas but is unable to play animations or complex operations.\n
This renders a very similar image as the HTML Canvas example.\nOf course, this could be created in code as the HTML Canvas objects were created in Javascript, but why the heck would you want to do that??\n
\n
These are all features considered part of HTML5 that I haven&#x2019;t covered thus far. I didn&#x2019;t consider them major talking points in the comparison with Silverlight, especially in the context of building business applications.\n
... continued\n
These are all features of Silverlight that I wanted to call out because there isn&#x2019;t any comparable feature of HTML5.\nXAML is a category unto itself - it covers so many HTML5 enhancements out of the box.\n
After considering all the features of each technology, it really all depends on what you need to solve your specific problem(s).\n