HTML5 & JavaScript: The Future Now

61
HTML5 & JAVASCRIPT The future now Rob Hawkes Hi, I’m Rob Hawkes and I’m here today to introduce HTML5 & JavaScript and talk about why they’re awesome.

description

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

Transcript of HTML5 & JavaScript: The Future Now

Page 1: HTML5 & JavaScript: The Future Now

HTML5 & JAVASCRIPT

The future now

Rob Hawkes

Hi, I’m Rob Hawkes and I’m here today to introduce HTML5 & JavaScript and talk about why they’re awesome.

Page 2: HTML5 & JavaScript: The Future Now

I work at Mozilla.

If you’re unsure about how much I love Mozilla then check out this beautiful chicken and leek pie with extra Firefox goodness.

It was made by my talented girlfriend and it was delicious.

Page 3: HTML5 & JavaScript: The Future Now

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 new technologies on the Web.

And for those of you with no idea of what a rawket is, I made a multiplayer game called Rawkets in which players fly around in little rockets and shoot each other in the face with the latest Web technologies.

It’s actually quite fun!

http://rawkets.com

Page 4: HTML5 & JavaScript: The Future Now

Like Kerri-Anne I’m also a recent graduate, last May I finished my degree in Interactive Media Production at Bournemouth University.

Page 5: HTML5 & JavaScript: The Future Now

We should have enough time for questions at the end but also feel free to grab me in person after 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.

Page 6: HTML5 & JavaScript: The Future Now

Created by Phil Banks (@emirpprime)

Now, it’s no secret that I spend most of my time experimenting with HTML5 and other cool technologies like JavaScript.

If you’ve met me before then you probably already know about my slight addiction to HTML5 canvas, visual programming, and gaming.

Page 7: HTML5 & JavaScript: The Future Now

HTML5 & JavaScript

What is all the fuss about?

But what are HTML5 & JavaScript? And what’s all the fuss about?

Page 8: HTML5 & JavaScript: The Future Now

Upgrading outdated tech

Preparing the Web for the future

At the heart of matters, HTML5 is basically just an incremental upgrade to HTML that provides 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 various improvements to what already exists.

The same is true with the new JavaScript APIs; they aren’t a new version of JavaScript, just additions to the existing programming language to provide new features.

Page 9: HTML5 & JavaScript: The Future Now

Open technologies

Anyone can view the source code

They are open technologies.

Anyone can get involved in their creation; through browser developers like Mozilla, or through 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 these technologies. What was cool was that anyone was allowed to take part; which included everyday developers, employees of major browsers, and games companies.

Also, these technologies are open in that anyone can view the resulting code that is used within Web pages, which is a fantastic way of learning.

Page 10: HTML5 & JavaScript: The Future Now

Free technologies

Free to use. Free to develop with

They are free technologies.

Anyone can use these technologies without having to pay anything, both for using the technology and developing with it.

This is unlike closed environments like Flash where you have to pay to use official code editors and production environments.

Page 11: HTML5 & JavaScript: The Future Now

Plugin-less

No more reliance on third-party software

They 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 rich media.

Page 12: HTML5 & JavaScript: The Future Now

Interoperable

They are built to work across platforms

These technologies are built to work across platforms; whether that’s desktop, mobile, TV, or anything else!

This makes it great to develop this way because you can be sure that it will work the same way on any platform that has support.

Page 13: HTML5 & JavaScript: The Future Now

Cross-browser support

Most major fe

atures are supported

As with any technology on the Web it’s important that you can use it across all the major browsers.

Fortunately the bigger and older features of HTML5 like video are supported by all the major browsers, with some of the newer and smaller features getting better support as time goes on.

The situation isn’t perfect but we’re definitely in a position where these technologies can now be used in production.

Page 14: HTML5 & JavaScript: The Future Now

There’s a fantastic website called Can I Use which lets you know what browsers support each technology.

http://caniuse.com

Page 15: HTML5 & JavaScript: The Future Now

My favourites

Highlighting some the best new features

There are so many new features that HTML5 & JavaScript bring to the table. So many in fact that 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 spike your imagination.

Page 16: HTML5 & JavaScript: The Future Now

Structure and content

New elements for a modern Web

Some 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.

Page 17: HTML5 & JavaScript: The Future Now

<section>

<header>

<footer>

<nav>

<article><aside>

<section> describes a generic section of website, allowing content to be grouped into logical themes 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 like copyright 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 be distributed through multiple methods (like RSS), commonly things like blog posts and news articles.<aside> describes an area of content that is related to the content surrounding it but that isn’t that important within itself, commonly things like pull-quotes.

Page 18: HTML5 & JavaScript: The Future Now

<figcaption>

<figure>

<mark>

<time>

<figure> describes content that annotates the surrounding content using something like an image, video, or code.<figcaption> describes the caption of <figure> content and should therefore be placed within the <figure> element.<mark> describes words and phrases that are considered important for the purpose of referencing, like highlighting key words in a quote from another piece of content.<time> describes date or time-related content

Page 19: HTML5 & JavaScript: The Future Now

Forms

Making input less of a hassle

Forms are another area of HTML5 that got a big upgrade.

Page 20: HTML5 & JavaScript: The Future Now

Basic validation

Client-side and not to be tru

sted

One of those areas is basic validation of inputted data on the client-side, that is the user’s browser.

This type of validation can be easily worked around but it’s useful for providing hints to a user when they enter incorrect information without having to send the data to a server or run lots of custom JavaScript.

Page 21: HTML5 & JavaScript: The Future Now

email, tel, urltype=…datecolorrange

There 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 to remove or add relevant keys. For example, only showing numbers for an input field with a type 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.

http://wufoo.com/html5/

Page 22: HTML5 & JavaScript: The Future Now

<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’s uploading.

<meter> describes part of a form that shows a measured outcome, like the final grade out of 10 in an exam.

<output> describes part of a form that shows the results of a calculation performed by the form itself.

Page 23: HTML5 & JavaScript: The Future Now

Geolocation

Providing location-based content

Geolocation is a new JavaScript API that allows a website to request the geographic location of 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 that data to pre-populate a form, saving the user some of their precious time.

Page 24: HTML5 & JavaScript: The Future Now

Security and peace of mind is of paramount importance with the new features being introduced.

The Geolocation API is no exception and a browser will only be able to access your personal information if you explicitly allow it to each and every time.

Page 25: HTML5 & JavaScript: The Future Now

Local storage

Cookies on steroids

There are a variety of solutions available that each allow you to access and store data on a user’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 way within 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 you save and retrieve files much larger than would be permitted in any other solution.

Page 26: HTML5 & JavaScript: The Future Now

Web Workers

Delegating tasks to others

Web Workers are a JavaScript API that allow you to run computationally-heavy calculations in the 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 to analyse a lot of data behind the scenes.

https://developer.mozilla.org/En/Using_web_workers

Page 27: HTML5 & JavaScript: The Future Now

History API

Providing dynamic content the right w

ay

The History API is a selection of JavaScript APIs that allow you to manipulate a user’s browsing history.

This is exciting because is allows dynamic AJAX-type websites to continue loading content without refreshing the page while not breaking the back and forward buttons within the browser. Normally this wouldn’t be possible.

https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

Page 28: HTML5 & JavaScript: The Future Now

Full Screen API

Simple, yet powerful

The Full Screen API allows you to expand any HTML element to fill the users screen, even if the browser isn’t running full screen itself.

It’s a really simple API that is useful for immersive visual media like video and games.

https://bugzilla.mozilla.org/show_bug.cgi?id=545812http://blog.pearce.org.nz/2011/09/mozilla-full-screen-api-progress-update.htmlhttps://wiki.mozilla.org/Platform/Features/Full_Screen_APIs

Page 29: HTML5 & JavaScript: The Future Now

Canvas

2D graphics platform

As 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 that canvas and manipulate it.

It’s quite amazingly what can be done with such simple drawing and image manipulation tools.

Page 30: HTML5 & JavaScript: The Future Now

Silk is a stunning example of what can be achieved by combining the simple drawing tools available in canvas.

http://weavesilk.com

Page 31: HTML5 & JavaScript: The Future Now

Close Pixelate is a canvas app that lets you manipulate images on–the-fly to create a pixelated effect.

http://desandro.com/resources/close-pixelate/

Page 32: HTML5 & JavaScript: The Future Now

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 achieve this.

http://desandro.com/portfolio/

Page 33: HTML5 & JavaScript: The Future Now

Google Plus has a seriously cool feature that lets you take a screenshot of a page and highlight areas of interest. It’s great as a user can highlight areas of a problem and submit the screenshot for feedback.

I’m unsure if they are using canvas here, but it’s not impossible for canvas to be used in this way and it’s a really innovative use of the technology.

https://plus.google.com

Page 34: HTML5 & JavaScript: The Future Now

WebGL

3D graphics platform

WebGL brings the ability to provide advanced 3D graphics directly within the browser.

It’s great for gaming and visualisations.

Page 35: HTML5 & JavaScript: The Future Now

HelloRacer is a little game that lets you drive a Formula One car around your browser. It’s a beautiful example of WebGL in action.

http://helloracer.com/webgl/

Page 36: HTML5 & JavaScript: The Future Now

Rome is a music video created with WebGL. It’s an amazing example of what the technology can achieve in a real-world situation given a large and talented team.

http://ro.me

Page 37: HTML5 & JavaScript: The Future Now

Tinkercad is probably the most practical use of WebGL that I’ve seen in a production situation.

It’s a Web app that allows you to create 3D objects in your browser using WebGL, then get them printed and sent to your doorstep in just a few simple clicks. It’s seriously awesome.

https://tinkercad.com

Page 38: HTML5 & JavaScript: The Future Now

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’t much unlike the quality of modern games consoles!

http://www.everyday3d.com/j3d/demo/014_Head.html

Page 39: HTML5 & JavaScript: The Future Now

Video

The reliance on Flash is over

HTML5 video is one of the biggest improvements with HTML5; no longer do you have to rely on Flash to provide rich video on the Web.

Page 40: HTML5 & JavaScript: The Future Now

SublimeVideo is a service that allows you to implement beautiful HTML5 video across all the major browsers.

It’s main draw is the custom video controls that look really pretty.

http://sublimevideo.net

Page 41: HTML5 & JavaScript: The Future Now

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 automatically change the website content depending on what point of video is currently being played.

http://popcornjs.org

Page 42: HTML5 & JavaScript: The Future Now

Audio

More Flash reliance vaporisation

Along with HTML5 video comes HTML5 audio, which again means that there is now a legitimate alternative to Flash.

Page 43: HTML5 & JavaScript: The Future Now

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.

http://robhawkes.github.com/webgl-html5-audio-visualiser/

Page 44: HTML5 & JavaScript: The Future Now

WebSockets

Bi-directional real-time communication

WebSockets are another technology at the top of my list.

It allows you to provide bi-directional real-time communication between a browser and a server.

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, the stock market, and chat.

Page 45: HTML5 & JavaScript: The Future Now

Rawkets is the game I mentioned at the beginning that allows you to shoot your friends in the face 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.

http://rawkets.com

Page 46: HTML5 & JavaScript: The Future Now

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.

http://pusher.com

Page 47: HTML5 & JavaScript: The Future Now

Device APIs

Accessing hardware with JavaScript

Device APIs is a catch-all term for the technologies that allow developers to access hardware and operating system APIs using JavaScript.

Page 48: HTML5 & JavaScript: The Future Now

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 who are 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 with JavaScript.

What APIs would you need to do that?

http://hacks.mozilla.org/2011/08/introducing-webapi/http://arewemobileyet.com/

Page 49: HTML5 & JavaScript: The Future Now

My favourites

Device APIs I cannot wait fo

r

There are so many Device APIs in the pipeline when you combine all the efforts by the various browser manufacturers.

Here are just a few of my favourites.

Page 50: HTML5 & JavaScript: The Future Now

Media Capture API

Accessing the camera and microphone

The 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 using the webcam and use that instead. Simple but effective.

You could also do things like using the microphone input for voice recognition in for input areas. I know Google are already experimenting heavily in this area.

Page 51: HTML5 & JavaScript: The Future Now

WebNFC API

RFID-like wireless communication

The WebNFC API is pretty cool.

It gives you the ability to transmit and receive data within distances no larger than a few centimetres.

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.

https://bugzilla.mozilla.org/show_bug.cgi?id=674741

Page 52: HTML5 & JavaScript: The Future Now

WebSMS API

Sending texts with JavaScript. ‘Nuff s

aid

The WebSMS API isn’t the most glamorous, but the idea of sending text messages with JavaScript is quite appealing.

https://bugzilla.mozilla.org/show_bug.cgi?id=674725

Page 53: HTML5 & JavaScript: The Future Now

WebTelephony API

Make and receive calls

The 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 Siri that answers your calls for you if you’re busy.

https://bugzilla.mozilla.org/show_bug.cgi?id=674726

Page 54: HTML5 & JavaScript: The Future Now

WebVibrator API

Vibrating you with open technologies

But my new favourite by far is the WebVibrator API, it just makes me laugh every time I hear it.

https://bugzilla.mozilla.org/show_bug.cgi?id=679966

Page 55: HTML5 & JavaScript: The Future Now

Node.js

Run JavaScript on the server

Node isn’t technically part of the new HTML5 & JavaScript technologies, but it’s too cool to miss out.

Effectively what Node allows you to do is to run JavaScript code on the server, which has many benefits.

The major benefit is that your code can run asynchronously, which means that you can do multiple 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 free modules for it to add extra functionality, which means that it saves you a tonne of time when making your Web app.

http://nodejs.org

Page 56: HTML5 & JavaScript: The Future Now

Many more

Much has changed on the Web

There 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 if you’re interested:

Dive Into HTML5 - http://diveintohtml5.orgHTML5 Doctor - http://html5doctor.comMozilla Developer Network - https://developer.mozilla.org

Page 57: HTML5 & JavaScript: The Future Now

Threshold of something cool

The time is now

So 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 same technology.

This is definitely a good time to be developing on the Web and I hope I’ve managed to peak your interest in what HTML5 and JavaScript can provide, even just a little bit.

Page 58: HTML5 & JavaScript: The Future Now

Rob Hawkes

Rawkets.comHTML5 & WebSockets game

Twitter sentiment analysisDelving into your soul

RECENT PROJECTS

Rawkes.comPersonal website and blog

MORE COOL STUFF

Rawket ScientistTechnical Evangelist at Mozilla

@robhawkes

ExplicitWeb.co.ukWeb development podcast

Get in touch with me on Twitter: @robhawkes

Follow my blog (Rawkes) to keep up to date with stuff that I’m working on: http://rawkes.com

I’ve recently worked on a project that analyses sentiment on Twitter: http://rawkes.com/blog/2011/05/05/people-love-a-good-smooch-on-a-balcony

Rawkets is my multiplayer HTML5 and JavaScript game. Play it, it’s fun: http://rawkets.com

Page 59: HTML5 & JavaScript: The Future Now

Become a canvas master

RAWKES.COM/FOUNDATIONCANVAS

Out now

Paperback and digital formats

Learn how to animate

Make two cool space games

Foundation HTML5 Canvas

Foundation HTML5 Canvas is out now on Amazon and other reputable book stores.

http://rawkes.com/foundationcanvas

Page 60: HTML5 & JavaScript: The Future Now

Hand-picked experts

@ASKMDN & #ASKMDN ON TWITTER

Coming back this year

Web development topics

Great discussions

Ask MDN

ASKMDNOne hour every fortnight

And lastly, I’d like to quickly mention Ask MDN which is a project that I’m working on at Mozilla.

The concept is simple. One hour every fortnight we gather a bunch of experts on Twitter to answer your questions about a particular topic.

We’ve had 4 sessions to date and it’s going down really well. If you follow @AskMDN on Twitter you’ll be sure not to miss the next session.

http://twitter.com/AskMDN

Page 61: HTML5 & JavaScript: The Future Now

THANK YOU

Any questions?

Rob Hawkes

@robhawkes

Thank you.

If you have any questions feel free to grab me on Twitter (@robhawkes) or email [email protected].