HTML5 features & JavaScript APIs
Fisnik Doko
Microsoft Certified Trainer / Semos Education
HTML5 features & JavaScript APIs
2
Please Mute your
mobile devices
3
General Sponsors
Platinum Sponsors
Silver Sponsors
Gold Sponsors
Bronze Sponsors
4
Speaker
Fisnik Doko
• MCSD – Web Apps
• MCPD – Web Developer
• MCSE – Data Platform
• MCSA – SQL 2012/2014
• MCTS – Web Forms, Data Access, WCF
• MS – C#, HTML5, MVC, SHP 2013
• MCP, MCT, MSc
• Microsoft Trainer – Semos Education
• Software Developer – NBRM
• Consultant
5
HTML 5 Features
6
HTML 4 VS HTML 5
• You don’t get rid of HTML4 standards – you just improve upon them!
7
Standard Improvements
What's New in HTML5?
HTML5 provides many extensions over previous versions, including:
• Rules for browser vendors
• New elements that reflect modern web application development
• JavaScript APIs that support desktop and mobile application
capabilities
• Each version of HTML has its own DOCTYPE
– The browser uses the DOCTYPE declaration to determine how
to interpret the HTML markup
– For HTML5 pages, specify a DOCTYPE of html
<!DOCTYPE HTML>
8
Document Structure in HTML5
HTML5 provides new elements to define the structure of a web page:
• <section> to divide up main content
• <header> and <footer>
for page headers and footers
• <nav> for navigations links
• <article> for stand-alone content
• <aside> for quotes and sidebar content
• <hgroup>
• <figure> and <figcaption>
• <mark>
9
HTML5 Input Type
• <input type=“range”> - for sliders
• <input type=“color”> - for color pickers
• <input type=“tel”> - for telephone numbers
• <input type=“url”> - for web addresses
• <input type=“email”> - for email addresses
• <input type=“date”> - for calendar date pickers
• <input type=“month”> - for a list of months
• <input type=“week”> - for weeks
• <input type=“time”> - timestamps
• <input type=“datetime”> - for precise, absolute date+time
• <input type=“datetime-local”> - for local dates and times
• <input type=“number”> - for spinboxes
• <input type=“search”> - for search boxes
10
HTML5 Input Attributes
• Input attributes modify the behavior of input types and forms to provide
better feedback and usability:
– autofocus
– autocomplete
– required
– pattern
– placeholder
– many other input type-specific attributes
– Ex. number input type supports the max, min, step, and value attributes
• If the data is not valid, display custom error message by using the
setCustomValidity function
11
Demo
12
Creating Interactive Pages by Using
HTML5 APIs
13
File API
• The HTML5 File API enables a web application to access the local
file system
• There are four key interfaces:
– Blob – immutable raw binary data
– File - read-only information about a file (name, size, type)
– FileList – an array of files
– FileReader – methods for reading data from a file or blob
• The FileReader interface provides methods for reading a file or blob
• FileReader reads data asynchronously and fires events
• File contents are available through the result attribute on the
FileReader object
14
Drag & Drop API
• Allows objects to be dragged and then dropped onto a target.
• HTML5 supports drag-and-drop
– The user can drag HTML elements, or files
from the local file system
– The user can drop items onto drop-enabled
target elements
• To support drag and drop operations
– Enable drag support on HTML elements, if required
– Enable drop support on HTML drop target elements
• Propagation and Prevention
15
Drag Source Drag Target
dragstart
drag dragenter
dragover
dragleave
drop
dragend
HTML5 Audio and Video
• New HTML5 media elements
– <audio> and <video>
• Native audio and video
• Add videos and audio as if it was an image
• Codec support varies, but multiple
source elements and fallback
content can be used
• Complete JavaScript API available
16
<video width="300" height="200"
poster="MyPoster.jpg"
autoplay="autoplay"
muted="muted"
controls="controls"
loop="loop" >
<source src="media/video1.mp4"
type="video/mp4" />
<source src="media/video1.ogv"
type="video/ogg" />
<source src="media/video1.webm"
type="video/webm" />
<object id="flash1" data="Media/Video1.swf"
type="application/x-shockwave-flash">
<param name="movie"
value="Media/Video1.swf">
</object>
</video>
GeoLocation API
• Geolocation interface represents an object able to
programmatically obtain the position of the device
• A host device can use several techniques to obtain geolocation
information:
– IP address
– GPS positioning
– Wi-Fi
– Cell phone location
– User-defined location information
17
navigator.geolocation.getCurrentPosition(myPositionCallbackFunction,
myPositionErrorCallbackFunction,
{enableHighAccuracy: true, timeout: 5000} );
var watchID = navigator.geolocation.watchPosition(myPositionCallbackFunction,
myPositionErrorCallbackFunction,
{enableHighAccuracy: true, maximumAge: 10000} );
Page Visibility API
• Page Visibility API consists of two properties and an event:
– document.hidden property describes whether the page is
visible or not
– The visibilitychange event fires any time the visibility state
of the page changes
• HTML5 allows online and offline detection
• navigator.onLine property, which indicates whether the
browser is online or offline
18
Web Workers
• Web workers enable a web page to move code to a parallel execution
environment, enabling the browser to remain responsive
1. Dedicated web workers
2. Shared web workers
• A web page communicates with a web worker by sending and
receiving messages:
– Send messages by using the postMessage() function
– Receive messages by handling the message event
19
SVG & CANVAS
• Vector-based graphics for the Web
• SVG defines the graphics in XML format
• SVG graphics do NOT lose any quality if they are zoomed or resized
• Popular library https://d3js.org/
• The Canvas API enables you to draw onto a bitmap area
– Immediate mode: "fire and forget"
• JavaScript APIs and drawing primitives
– Simple API: 45 methods, 21 attributes
– Rectangles, lines, fills, arcs, Bezier curves, …
• Creating games in HTML5 Canvas
• http://canvasengine.net/
20
Demo
21
Adding Offline Support to Web
Applications
22
Application Cache API
• The application cache manifest file specifies the
resources to cache
• Use complete web sites in offline mode
• Browsers cache data in an Application Cache
• Application cache gives an application three advantages:
– Offline browsing - users can use the application when
they're offline
– Speed - cached resources load faster
– Reduced server load
23
CACHE MANIFEST
# version 2.0
CACHE:
index.html
verification.js
site.css
graphics/logo.jpg
NETWORK:
/login
# alternatives paths
FALLBACK:
/ajax/account/
/noCode.htm
<html manifest=“test.appcache">
Local Storage API - Web Storage
• Local storage is more secure than cookies
• Limit is far larger (at least 5MB) and information is never
transferred to the server
• Local storage is per domain.
• Local storage persists until it is explicitly deleted or the browser’s
cache is cleared.
• Session storage persists until it is explicitly deleted or the browsing
context is closed.
• HTML local storage provides two objects for storing data on the
client:
– window.localStorage - stores data with no expiration date
– window.sessionStorage - stores data for one session
24
Indexed Database API
• IndexedDB provides an efficient means for storing structured data on
the user’s computer
• IndexedDB is a JavaScript-based object-oriented database
• Powerful, but may seem too complicated for simple case
• The API is asynchronous, and includes the following features:
– Multiple object stores
– Transactions
– Indexes to speed up common queries
• For IndexedDB, you can use up to 50MB on desktop
25
Demo
26
XMLHttpRequest, WebSocket
• XMLHttpRequest Level 2 – significantly enhanced
– Cross-origin XMLHttpRequests
– Progress events
– Binary Data
• Web sockets are a solution for implementing real-time
bidirectional communications on the web
• The WebSockets API defines a JavaScript API for code running in
a browser
27
Animating the User Interface
28
Transforming elements
Types of transformation supported by CSS:
– Translating
– Rotating
– Scaling
– Skewing
29
div.rotate1 {
transform: rotate(10deg);
transform-origin: left top;
}
Keyframe Animation
• SWIFFY, GOOGLE WEB DESIGNER, ADOBE EDGE
30
@keyframes name_of_animation {
0% { /* or from */
… properties to at the start of the animation …
}
50% {
… properties to apply after 50% of the animation …
}
100% { /* or to */
… properties to apply at the end of the animation …
}
}
CSS_rule_to_apply_animation {
animation-name: name_of_animation;
animation-duration: duration_of_animation;
…
}
CSS 3
• Media Queries
• border-radius
• box-shadow
• text-shadow
• Linear and radial gradient
• column-width & column-gap
• @font-face
• http://www.css3maker.com/
31
Future
32
Complete the evaluation
and earn the chance to win
prizes in the closing raffle
http://eval.codecamp.mk
33
Questions
Thank you

More Related Content

PPTX
No SQL, No Problem: Use Azure DocumentDB
ODP
REST services and IBM Domino/XWork - DanNotes 19-20. november 2014
PDF
IBM Connect 2014 - AD205: Creating State-of-the-Art Web Applications with Dom...
PPTX
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
PDF
Drupal Is Not Your Web Site
PPTX
Oracle application container cloud back end integration using node final
PPTX
SQL to NoSQL: Top 6 Questions
PPTX
Pci multitenancy exalogic at AMIS25
No SQL, No Problem: Use Azure DocumentDB
REST services and IBM Domino/XWork - DanNotes 19-20. november 2014
IBM Connect 2014 - AD205: Creating State-of-the-Art Web Applications with Dom...
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Drupal Is Not Your Web Site
Oracle application container cloud back end integration using node final
SQL to NoSQL: Top 6 Questions
Pci multitenancy exalogic at AMIS25

What's hot (20)

PPTX
Ajax:From Desktop Applications towards Ajax Web Applications
PDF
Drupal is not your Website
KEY
The data layer
PPTX
PPTX
Azure Platform
PDF
Building LinkedIn's Learning Platform with MongoDB
PDF
Cert05 70-487 - developing microsoft azure and web services
PDF
HTML5 Refresher
KEY
WHAT IS HTML5? (at CSS Nite Osaka)
PPTX
Microsoft Web Technology Stack
KEY
Exciting JavaScript - Part II
KEY
Optimization of modern web applications
PDF
facebook architecture for 600M users
PDF
Caching Strategies for Scaling Drupal: Common Missteps vs Best Practices
PDF
jmp206 - Lotus Domino Web Services Jumpstart
PDF
Local Storage for Web Applications
PPTX
Servletarchitecture,lifecycle,get,post
PPTX
Migration from Legacy CMS to Drupal
PDF
Asp.net
PPTX
Ajax:From Desktop Applications towards Ajax Web Applications
Drupal is not your Website
The data layer
Azure Platform
Building LinkedIn's Learning Platform with MongoDB
Cert05 70-487 - developing microsoft azure and web services
HTML5 Refresher
WHAT IS HTML5? (at CSS Nite Osaka)
Microsoft Web Technology Stack
Exciting JavaScript - Part II
Optimization of modern web applications
facebook architecture for 600M users
Caching Strategies for Scaling Drupal: Common Missteps vs Best Practices
jmp206 - Lotus Domino Web Services Jumpstart
Local Storage for Web Applications
Servletarchitecture,lifecycle,get,post
Migration from Legacy CMS to Drupal
Asp.net
Ad

Similar to HTML5 features & JavaScript APIs (20)

PPTX
Html5 phillycc
PDF
HTML5 and CSS3 refresher
PPTX
Introduction to HTML5 & CSS3
PPTX
HTML5 Programming
PPT
Building intranet applications with ASP.NET AJAX and jQuery
PDF
Building Rich Internet Apps with Silverlight 2
PDF
Webdev battacherjee
PPTX
Html 5
PPTX
IE10 PP4 update for W3C HTML5 KIG
PDF
Serverless SQL
PPTX
HTML5: An Overview
PDF
Html5 n css3
PPTX
Tech io spa_angularjs_20130814_v0.9.5
PPTX
Web Development Technologies
PPTX
What is HTML 5?
PPTX
Google appenginejava.ppt
PDF
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
PDF
Code for Startup MVP (Ruby on Rails) Session 1
PDF
Cloud Computing in Systems Programming Curriculum
PPTX
Bringing HTML5 alive in SharePoint
Html5 phillycc
HTML5 and CSS3 refresher
Introduction to HTML5 & CSS3
HTML5 Programming
Building intranet applications with ASP.NET AJAX and jQuery
Building Rich Internet Apps with Silverlight 2
Webdev battacherjee
Html 5
IE10 PP4 update for W3C HTML5 KIG
Serverless SQL
HTML5: An Overview
Html5 n css3
Tech io spa_angularjs_20130814_v0.9.5
Web Development Technologies
What is HTML 5?
Google appenginejava.ppt
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
Code for Startup MVP (Ruby on Rails) Session 1
Cloud Computing in Systems Programming Curriculum
Bringing HTML5 alive in SharePoint
Ad

More from Fisnik Doko (7)

PPTX
Developing Solutions for Azure - Best Practices
PPTX
Building Scalable Applications with Microsoft Azure
PDF
Power BI measure and visualize project success
PDF
Microsoft's modern technologies
PDF
Predictive Analysis using Microsoft SQL Server R Services
PDF
C# 7 development
PPTX
Analyses and processing of big data in financial services
Developing Solutions for Azure - Best Practices
Building Scalable Applications with Microsoft Azure
Power BI measure and visualize project success
Microsoft's modern technologies
Predictive Analysis using Microsoft SQL Server R Services
C# 7 development
Analyses and processing of big data in financial services

Recently uploaded (20)

PPTX
Education and Perspectives of Education.pptx
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
PDF
semiconductor packaging in vlsi design fab
PDF
English Textual Question & Ans (12th Class).pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
Complications of Minimal Access-Surgery.pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PPTX
Computer Architecture Input Output Memory.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
Education and Perspectives of Education.pptx
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Environmental Education MCQ BD2EE - Share Source.pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
Race Reva University – Shaping Future Leaders in Artificial Intelligence
semiconductor packaging in vlsi design fab
English Textual Question & Ans (12th Class).pdf
HVAC Specification 2024 according to central public works department
Complications of Minimal Access-Surgery.pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
My India Quiz Book_20210205121199924.pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
Computer Architecture Input Output Memory.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Introduction to pro and eukaryotes and differences.pptx
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Core Concepts of Personalized Learning and Virtual Learning Environments

HTML5 features & JavaScript APIs

  • 2. Fisnik Doko Microsoft Certified Trainer / Semos Education HTML5 features & JavaScript APIs 2
  • 4. General Sponsors Platinum Sponsors Silver Sponsors Gold Sponsors Bronze Sponsors 4
  • 5. Speaker Fisnik Doko • MCSD – Web Apps • MCPD – Web Developer • MCSE – Data Platform • MCSA – SQL 2012/2014 • MCTS – Web Forms, Data Access, WCF • MS – C#, HTML5, MVC, SHP 2013 • MCP, MCT, MSc • Microsoft Trainer – Semos Education • Software Developer – NBRM • Consultant 5
  • 7. HTML 4 VS HTML 5 • You don’t get rid of HTML4 standards – you just improve upon them! 7 Standard Improvements
  • 8. What's New in HTML5? HTML5 provides many extensions over previous versions, including: • Rules for browser vendors • New elements that reflect modern web application development • JavaScript APIs that support desktop and mobile application capabilities • Each version of HTML has its own DOCTYPE – The browser uses the DOCTYPE declaration to determine how to interpret the HTML markup – For HTML5 pages, specify a DOCTYPE of html <!DOCTYPE HTML> 8
  • 9. Document Structure in HTML5 HTML5 provides new elements to define the structure of a web page: • <section> to divide up main content • <header> and <footer> for page headers and footers • <nav> for navigations links • <article> for stand-alone content • <aside> for quotes and sidebar content • <hgroup> • <figure> and <figcaption> • <mark> 9
  • 10. HTML5 Input Type • <input type=“range”> - for sliders • <input type=“color”> - for color pickers • <input type=“tel”> - for telephone numbers • <input type=“url”> - for web addresses • <input type=“email”> - for email addresses • <input type=“date”> - for calendar date pickers • <input type=“month”> - for a list of months • <input type=“week”> - for weeks • <input type=“time”> - timestamps • <input type=“datetime”> - for precise, absolute date+time • <input type=“datetime-local”> - for local dates and times • <input type=“number”> - for spinboxes • <input type=“search”> - for search boxes 10
  • 11. HTML5 Input Attributes • Input attributes modify the behavior of input types and forms to provide better feedback and usability: – autofocus – autocomplete – required – pattern – placeholder – many other input type-specific attributes – Ex. number input type supports the max, min, step, and value attributes • If the data is not valid, display custom error message by using the setCustomValidity function 11
  • 13. Creating Interactive Pages by Using HTML5 APIs 13
  • 14. File API • The HTML5 File API enables a web application to access the local file system • There are four key interfaces: – Blob – immutable raw binary data – File - read-only information about a file (name, size, type) – FileList – an array of files – FileReader – methods for reading data from a file or blob • The FileReader interface provides methods for reading a file or blob • FileReader reads data asynchronously and fires events • File contents are available through the result attribute on the FileReader object 14
  • 15. Drag & Drop API • Allows objects to be dragged and then dropped onto a target. • HTML5 supports drag-and-drop – The user can drag HTML elements, or files from the local file system – The user can drop items onto drop-enabled target elements • To support drag and drop operations – Enable drag support on HTML elements, if required – Enable drop support on HTML drop target elements • Propagation and Prevention 15 Drag Source Drag Target dragstart drag dragenter dragover dragleave drop dragend
  • 16. HTML5 Audio and Video • New HTML5 media elements – <audio> and <video> • Native audio and video • Add videos and audio as if it was an image • Codec support varies, but multiple source elements and fallback content can be used • Complete JavaScript API available 16 <video width="300" height="200" poster="MyPoster.jpg" autoplay="autoplay" muted="muted" controls="controls" loop="loop" > <source src="media/video1.mp4" type="video/mp4" /> <source src="media/video1.ogv" type="video/ogg" /> <source src="media/video1.webm" type="video/webm" /> <object id="flash1" data="Media/Video1.swf" type="application/x-shockwave-flash"> <param name="movie" value="Media/Video1.swf"> </object> </video>
  • 17. GeoLocation API • Geolocation interface represents an object able to programmatically obtain the position of the device • A host device can use several techniques to obtain geolocation information: – IP address – GPS positioning – Wi-Fi – Cell phone location – User-defined location information 17 navigator.geolocation.getCurrentPosition(myPositionCallbackFunction, myPositionErrorCallbackFunction, {enableHighAccuracy: true, timeout: 5000} ); var watchID = navigator.geolocation.watchPosition(myPositionCallbackFunction, myPositionErrorCallbackFunction, {enableHighAccuracy: true, maximumAge: 10000} );
  • 18. Page Visibility API • Page Visibility API consists of two properties and an event: – document.hidden property describes whether the page is visible or not – The visibilitychange event fires any time the visibility state of the page changes • HTML5 allows online and offline detection • navigator.onLine property, which indicates whether the browser is online or offline 18
  • 19. Web Workers • Web workers enable a web page to move code to a parallel execution environment, enabling the browser to remain responsive 1. Dedicated web workers 2. Shared web workers • A web page communicates with a web worker by sending and receiving messages: – Send messages by using the postMessage() function – Receive messages by handling the message event 19
  • 20. SVG & CANVAS • Vector-based graphics for the Web • SVG defines the graphics in XML format • SVG graphics do NOT lose any quality if they are zoomed or resized • Popular library https://d3js.org/ • The Canvas API enables you to draw onto a bitmap area – Immediate mode: "fire and forget" • JavaScript APIs and drawing primitives – Simple API: 45 methods, 21 attributes – Rectangles, lines, fills, arcs, Bezier curves, … • Creating games in HTML5 Canvas • http://canvasengine.net/ 20
  • 22. Adding Offline Support to Web Applications 22
  • 23. Application Cache API • The application cache manifest file specifies the resources to cache • Use complete web sites in offline mode • Browsers cache data in an Application Cache • Application cache gives an application three advantages: – Offline browsing - users can use the application when they're offline – Speed - cached resources load faster – Reduced server load 23 CACHE MANIFEST # version 2.0 CACHE: index.html verification.js site.css graphics/logo.jpg NETWORK: /login # alternatives paths FALLBACK: /ajax/account/ /noCode.htm <html manifest=“test.appcache">
  • 24. Local Storage API - Web Storage • Local storage is more secure than cookies • Limit is far larger (at least 5MB) and information is never transferred to the server • Local storage is per domain. • Local storage persists until it is explicitly deleted or the browser’s cache is cleared. • Session storage persists until it is explicitly deleted or the browsing context is closed. • HTML local storage provides two objects for storing data on the client: – window.localStorage - stores data with no expiration date – window.sessionStorage - stores data for one session 24
  • 25. Indexed Database API • IndexedDB provides an efficient means for storing structured data on the user’s computer • IndexedDB is a JavaScript-based object-oriented database • Powerful, but may seem too complicated for simple case • The API is asynchronous, and includes the following features: – Multiple object stores – Transactions – Indexes to speed up common queries • For IndexedDB, you can use up to 50MB on desktop 25
  • 27. XMLHttpRequest, WebSocket • XMLHttpRequest Level 2 – significantly enhanced – Cross-origin XMLHttpRequests – Progress events – Binary Data • Web sockets are a solution for implementing real-time bidirectional communications on the web • The WebSockets API defines a JavaScript API for code running in a browser 27
  • 28. Animating the User Interface 28
  • 29. Transforming elements Types of transformation supported by CSS: – Translating – Rotating – Scaling – Skewing 29 div.rotate1 { transform: rotate(10deg); transform-origin: left top; }
  • 30. Keyframe Animation • SWIFFY, GOOGLE WEB DESIGNER, ADOBE EDGE 30 @keyframes name_of_animation { 0% { /* or from */ … properties to at the start of the animation … } 50% { … properties to apply after 50% of the animation … } 100% { /* or to */ … properties to apply at the end of the animation … } } CSS_rule_to_apply_animation { animation-name: name_of_animation; animation-duration: duration_of_animation; … }
  • 31. CSS 3 • Media Queries • border-radius • box-shadow • text-shadow • Linear and radial gradient • column-width & column-gap • @font-face • http://www.css3maker.com/ 31
  • 33. Complete the evaluation and earn the chance to win prizes in the closing raffle http://eval.codecamp.mk 33 Questions