Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

HTML5 & JavaScript: The Future Now


Published on

An overview of HTML5 and JavaScript and the exciting new opportunities that they open up.

Published in: Technology

HTML5 & JavaScript: The Future Now

  1. 1. IPT CR AS J V e now A ur 5 & t fu ML The bH aw kes HT RoHi, I’m Rob Hawkes and I’m here today to introduce HTML5 & JavaScript and talk about whythey’re awesome.
  2. 2. I work at Mozilla.If you’re unsure about how much I love Mozilla then check out this beautiful chicken and leekpie with extra Firefox goodness.It was made by my talented girlfriend and it was delicious.
  3. 3. My official job title is Technical Evangelist but I prefer what it says on my business card.Part of my job is to engage with developers and designers like you and I about cool newtechnologies on the Web.And for those of you with no idea of what a rawket is, I made a multiplayer game calledRawkets in which players fly around in little rockets and shoot each other in the face with thelatest Web technologies.It’s actually quite fun!
  4. 4. Like Kerri-Anne I’m also a recent graduate, last May I finished my degree in Interactive MediaProduction at Bournemouth University.
  5. 5. We should have enough time for questions at the end but also feel free to grab me in personafter this talk or on Twitter. I’m always happy to help.These slides will go online after this talk and they’ll be available from my personal website.I’ll put all the details up at the end.
  6. 6. Created by Phil Banks (@emirpprime)Now, it’s no secret that I spend most of my time experimenting with HTML5 and other cooltechnologies like JavaScript.If you’ve met me before then you probably already know about my slight addiction to HTML5canvas, visual programming, and gaming.
  7. 7. ipt Scr Java about? 5 & fuss L M at is all the HT h WBut what are HTML5 & JavaScript? And what’s all the fuss about?
  8. 8. c h d te ate ture u td or the fu g o bf din g the W e gra rin Up PrepaAt the heart of matters, HTML5 is basically just an incremental upgrade to HTML thatprovides a few new features that are desperately needed.It’s important not to look at HTML5 as an entirely new language, instead look at it as variousimprovements to what already exists.The same is true with the new JavaScript APIs; they aren’t a new version of JavaScript, justadditions to the existing programming language to provide new features.
  9. 9. ies log n o de ch source te he co en t Op nv iew ca yone AnThey are open technologies.Anyone can get involved in their creation; through browser developers like Mozilla, orthrough standards organisations like the W3C and WHATWG.Not long ago I was in a W3C meeting to explore what is needed for making games with thesetechnologies. What was cool was that anyone was allowed to take part; which includedeveryday developers, employees of major browsers, and games companies.Also, these technologies are open in that anyone can view the resulting code that is usedwithin Web pages, which is a fantastic way of learning.
  10. 10. ie s lo g n o ith e c h lop w e t de ve Fre ree to se.F u to FreeThey are free technologies.Anyone can use these technologies without having to pay anything, both for using thetechnology and developing with it.This is unlike closed environments like Flash where you have to pay to use official codeeditors and production environments.
  11. 11. less - in ware lug P soft rty d-pa thir on ce elian orer NomThey are technologies baked directly into the browser, which means no more plugins!No longer do you have to rely on users having third-party software installed to use richmedia.
  12. 12. b le e ra s rop rm Inte ss pla tfo cro orka ttow buil are ey ThThese technologies are built to work across platforms; whether that’s desktop, mobile, TV, oranything else!This makes it great to develop this way because you can be sure that it will work the sameway on any platform that has support.
  13. 13. o rt p p s u ed se r up po rt ro w ares -b ures ross ajor feat C m ost MAs with any technology on the Web it’s important that you can use it across all the majorbrowsers.Fortunately the bigger and older features of HTML5 like video are supported by all the majorbrowsers, with some of the newer and smaller features getting better support as time goeson.The situation isn’t perfect but we’re definitely in a position where these technologies can nowbe used in production.
  14. 14. There’s a fantastic website called Can I Use which lets you know what browsers support eachtechnology.
  15. 15. tes uri vo es y fa featur M estn ew theb e som hting lig HighThere are so many new features that HTML5 & JavaScript bring to the table. So many in factthat I could probably spend an entire day telling you about them.I don’t have that luxury today, so I’m going to show you some of my favourites to help spikeyour imagination.
  16. 16. n t n te c o eb n d rn W a de tu re for am o uc ts Str elem en ew NSome of the most useful additions with HTML5 are the structural and content elements.I won’t be covering them all but I’d like to highlight a few of the most prominent.
  17. 17. <header> <section> <nav> <aside> <article> <footer><section> describes a generic section of website, allowing content to be grouped into logicalthemes and areas.<header> describes the header of a website or area of content, commonly things like a logo,navigation, or header text in a body of content.<footer> describes the footer of a website or area of content, commonly things likecopyright notices and supplemental navigation.<nav> describes content that aids in the navigation of a website or content<article> describes an area of content that is self-contained and could potentially bedistributed through multiple methods (like RSS), commonly things like blog posts and newsarticles.<aside> describes an area of content that is related to the content surrounding it but thatisn’t that important within itself, commonly things like pull-quotes.
  18. 18. <figure> <figcaption> <mark> <time><figure> describes content that annotates the surrounding content using something like animage, video, or code.<figcaption> describes the caption of <figure> content and should therefore be placedwithin the <figure> element.<mark> describes words and phrases that are considered important for the purpose ofreferencing, like highlighting key words in a quote from another piece of content.<time> describes date or time-related content
  19. 19. s orm F ssle a ha of less ut inp aking MForms are another area of HTML5 that got a big upgrade.
  20. 20. ion at valid usted asic to be tr B nd not a ide t-s ClienOne of those areas is basic validation of inputted data on the client-side, that is the user’sbrowser.This type of validation can be easily worked around but it’s useful for providing hints to auser when they enter incorrect information without having to send the data to a server or runlots of custom JavaScript.
  21. 21. type=… email, tel, url date color rangeThere are also whole bunch of new input types for forms, including…Email, tel, and url, which cause the on-screen keyboard on mobile phones to change toremove or add relevant keys. For example, only showing numbers for an input field with atype of “tel”.Date, which makes it dead easy to let users select a date from a calendar.Color, which is an interesting type that shows a colour palette to select colour values from.Range, which limits the user to selecting a number within a defined range.
  22. 22. <progress> <meter> <output>Along with the added input types are brand new form elements.<progress> describes part of a form that shows progression, like the status of a file that’suploading.<meter> describes part of a form that shows a measured outcome, like the final grade out of10 in an exam.<output> describes part of a form that shows the results of a calculation performed by theform itself.
  23. 23. ion t ca ent eolo ont G asedc -b ation loc iding ProvGeolocation is a new JavaScript API that allows a website to request the geographic locationof the user.This information is massively useful for websites that provide location-based services,predominantly search-based services.It’s also useful for automating the process of finding a users town or country and using thatdata to pre-populate a form, saving the user some of their precious time.
  24. 24. Security and peace of mind is of paramount importance with the new features beingintroduced.The Geolocation API is no exception and a browser will only be able to access your personalinformation if you explicitly allow it to each and every time.
  25. 25. ge ra to oids cal s ster Lo on kies CooThere are a variety of solutions available that each allow you to access and store data on auser’s computer.They are IndexedDB, Local Storage as well as the various File and FileSystem APIs.IndexedDB and Local Storage allow large quantities of data to be stored in a structural waywithin a user’s browser, with IndexedDB even allowing files to be stored as well.The File and FileSystem APIs allow JavaScript to access the users’s OS filesystem, letting yousave and retrieve files much larger than would be permitted in any other solution.
  26. 26. e rs o rk rs b W othe e W g tasks to gatin DeleWeb Workers are a JavaScript API that allow you to run computationally-heavy calculations inthe background without slowing down and interfering with the user’s browsing experience.Their purpose is quite specific but they’re useful for creating applications that might need toanalyse a lot of data behind the scenes.
  27. 27. PI A ry to ht way His rig tthe ten con ic am yn ingd rovid PThe History API is a selection of JavaScript APIs that allow you to manipulate a user’sbrowsing history.This is exciting because is allows dynamic AJAX-type websites to continue loading contentwithout refreshing the page while not breaking the back and forward buttons within thebrowser. Normally this wouldn’t be possible.
  28. 28. PI n A re e ul Sc we rf ull et po F im ple ,y SThe Full Screen API allows you to expand any HTML element to fill the users screen, even ifthe browser isn’t running full screen itself.It’s a really simple API that is useful for immersive visual media like video and games.
  29. 29. vas an C tfo rm pla ics raph g 2DAs I mentioned at the beginning, canvas is easily one of my favourite new features.Canvas is a 2D graphics platform that uses both HTML5 and JavaScript.You use HTML5 to place a canvas on a Web page, and you use JavaScript to draw on to thatcanvas and manipulate it.It’s quite amazingly what can be done with such simple drawing and image manipulationtools.
  30. 30. Silk is a stunning example of what can be achieved by combining the simple drawing toolsavailable in canvas.
  31. 31. Close Pixelate is a canvas app that lets you manipulate images on–the-fly to create apixelated effect.
  32. 32. You can even use canvas just for simple effects on a standard Web page.David Desandro uses canvas to draw curved lines on his portfolio that indicate areas of focus.Before canvas you’d have had to have used static images or complex techniques to achievethis.
  33. 33. Google Plus has a seriously cool feature that lets you take a screenshot of a page andhighlight areas of interest. It’s great as a user can highlight areas of a problem and submitthe screenshot for feedback.I’m unsure if they are using canvas here, but it’s not impossible for canvas to be used in thisway and it’s a really innovative use of the technology.
  34. 34. GL eb W form lat sp hic grap 3DWebGL brings the ability to provide advanced 3D graphics directly within the browser.It’s great for gaming and visualisations.
  35. 35. HelloRacer is a little game that lets you drive a Formula One car around your browser. It’s abeautiful example of WebGL in action.
  36. 36. Rome is a music video created with WebGL. It’s an amazing example of what the technologycan achieve in a real-world situation given a large and talented team.
  37. 37. Tinkercad is probably the most practical use of WebGL that I’ve seen in a productionsituation.It’s a Web app that allows you to create 3D objects in your browser using WebGL, then getthem printed and sent to your doorstep in just a few simple clicks. It’s seriously awesome.
  38. 38. This is a rather freaky example of how interesting WebGL is.It’s a demo that shows just how realistic WebGL can render materials, like skin. This isn’tmuch unlike the quality of modern games consoles!
  39. 39. eo Vid er ov is sh Fla on ce elian r TheHTML5 video is one of the biggest improvements with HTML5; no longer do you have to relyon Flash to provide rich video on the Web.
  40. 40. SublimeVideo is a service that allows you to implement beautiful HTML5 video across all themajor browsers.It’s main draw is the custom video controls that look really pretty.
  41. 41. Popcorn.js is quite simply one of the most interesting tools that exists for HTML5 video.It allows you to tie-in video to content on the Web page, meaning that you can automaticallychange the website content depending on what point of video is currently being played.
  42. 42. dio Au ion at ris vapo ce ian rel sh Fla MoreAlong with HTML5 video comes HTML5 audio, which again means that there is now alegitimate alternative to Flash.
  43. 43. This is something I made especially for the ASSEMBLY 2011 event in Finland.It’s an audio visualiser that uses WebGL and the HTML5 Audio Data API.
  44. 44. e ts ock bS ation e W omm un ic ec l-tim al rea ction ire Bi-dWebSockets are another technology at the top of my list.It allows you to provide bi-directional real-time communication between a browser and aserver.This means you can push a user data instantly as soon as it becomes available.WebSockets are commonly used in situations where speed is important; like in games, thestock market, and chat.
  45. 45. Rawkets is the game I mentioned at the beginning that allows you to shoot your friends in theface with WebSockets and canvas.It’s still not really at a beta release level yet hence the bugs you might notice in this video,but it’s a good demo of a game created using these technologies.
  46. 46. Pusher is a service that lets you push data to your users in real-time using WebSockets.It’s a great example of how easy it is to use these technologies today in your project.
  47. 47. P Is e A evic cript D aS Jav ith arew ardw h ssing ce AcDevice APIs is a catch-all term for the technologies that allow developers to access hardwareand operating system APIs using JavaScript.
  48. 48. At Mozilla we’re working on the WebAPI effort which is our attempt at solving this problem.In other camps it might be referred to as DAP, which is the Device APIs Working Group whoare producing a W3C specification for accessing various parts of a device through JavaScript.The approach we’re taking is to try and replicate the functionality of a mobile phone withJavaScript.What APIs would you need to do that?
  49. 49. tes uri avo for y f ait tw M Ican no Is AP evice DThere are so many Device APIs in the pipeline when you combine all the efforts by the variousbrowser manufacturers.Here are just a few of my favourites.
  50. 50. PI A re tu phone ap ia C m icro ed era and M cam the ssing ce AcThe Media Capture API will let you access the camera and microphone on a device.Being able to do this with JavaScript will make a whole world of difference in so many areas.For example, instead of requiring a user to upload a profile image you could take one usingthe webcam and use that instead. Simple but effective.You could also do things like using the microphone input for voice recognition in for inputareas. I know Google are already experimenting heavily in this area.
  51. 51. P I C A NF ion eb un icat W m om sc les wire -like RFIDThe WebNFC API is pretty cool.It gives you the ability to transmit and receive data within distances no larger than a fewcentimetres.The idea is that it can be used in phones for things like payment (like the new Barclaycard),travel (think Oyster Card), and file transfer.
  52. 52. P I S A SM f said eb uf W cript . ‘N avaS ithJ xtsw te ing nd SeThe WebSMS API isn’t the most glamorous, but the idea of sending text messages withJavaScript is quite appealing.
  53. 53. P I y A o n lls p h ca Tele receive eb akea nd W MThe WebTelephony API allows you to make and receive phone calls using JavaScript.I can just imagine something like this being used to hook into a Web-based version of Sirithat answers your calls for you if you’re busy.
  54. 54. P I r A ra to ies Vib hn olog eb nt ec W itho pe youw ating VibrBut my new favourite by far is the WebVibrator API, it just makes me laugh every time I hearit.
  55. 55. e.js od N server he nt to Scrip Java RunNode isn’t technically part of the new HTML5 & JavaScript technologies, but it’s too cool tomiss out.Effectively what Node allows you to do is to run JavaScript code on the server, which hasmany benefits.The major benefit is that your code can run asynchronously, which means that you can domultiple tasks at once without having to wait for previous ones to finish.Another useful thing about Node is that the community have produced hundreds of freemodules for it to add extra functionality, which means that it saves you a tonne of time whenmaking your Web app.
  56. 56. o re y m an Web M d on the ge chan as uchh MThere are so many thing that I don’t have time to talk about.Things like gaming-related JavaScript APIs, Web application APIs, and much, much more!There are loads of resources around to help you find out more about these technologies ifyou’re interested:Dive Into HTML5 - http://diveintohtml5.orgHTML5 Doctor - http://html5doctor.comMozilla Developer Network -
  57. 57. o l g co thin s now e m The timei f so ld o o resh ThSo overall, I hope it’s obvious that we’re on the threshold of something awesome.We can now create amazing websites, apps, visualisations, and even games all with the sametechnology.This is definitely a good time to be developing on the Web and I hope I’ve managed to peakyour interest in what HTML5 and JavaScript can provide, even just a little bit.
  58. 58. Rob Hawkes @robhawkes Personal website and blog RECENT PROJECTS MORE COOL STUFF Twitter sentiment analysis Rawket Scientist Delving into your soul Technical Evangelist at Mozilla HTML5 & WebSockets game Web development podcastGet in touch with me on Twitter: @robhawkesFollow my blog (Rawkes) to keep up to date with stuff that I’m working on: http://rawkes.comI’ve recently worked on a project that analyses sentiment on Twitter: is my multiplayer HTML5 and JavaScript game. Play it, it’s fun:
  59. 59. Foundation HTML5 Canvas Out now Paperback and digital formats Become a canvas master Learn how to animate Make two cool space games RAWKES.COM/FOUNDATIONCANVASFoundation HTML5 Canvas is out now on Amazon and other reputable book stores.
  60. 60. Ask MDN Coming back this year One hour every fortnight ASKMDN Web development topics Hand-picked experts Great discussions @ASKMDN & #ASKMDN ON TWITTERAnd lastly, I’d like to quickly mention Ask MDN which is a project that I’m working on atMozilla.The concept is simple. One hour every fortnight we gather a bunch of experts on Twitter toanswer your questions about a particular topic.We’ve had 4 sessions to date and it’s going down really well. If you follow @AskMDN onTwitter you’ll be sure not to miss the next session.
  61. 61. O U Y s? K tion N ues A yq TH An R b es wk es Ha wk ob ha ro @Thank you.If you have any questions feel free to grab me on Twitter (@robhawkes) or