SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
HTML5
The next generation of HTML




                              By,
                              Kaushik Vinay T G
What is HTML5?


HTML5 will be the new standard for HTML,
 XHTML, and the HTML DOM.

The previous version of HTML came in 1999.
 The web has changed a lot since then.

HTML5 is still a work in progress. However, most
 modern browsers have some HTML5 support.
New Features
The canvas element for drawing

The video and audio elements for media
 playback

Better support for local offline storage

New content specific elements, like article,
 footer, header, nav, section

New form controls, like calendar, date, time,
 email, url, search
HTML5 Video/Audio
Until now, there has not been a standard for showing a Video/Audio on
 a web page.

HTML5 defines a new elements which specifies a standard way to
   embed a video/movie on a web page: the <video> element.

A standard way to embed a audio on web page: the <audio> element.

Currently, there are 3 supported video formats : MP4, WebM, and Ogg.

There are 3 supported audio formats:Mp3,Ogg, and Wav.

To show a video in HTML5, this is all you need:
 Code:
     <video width="320" height="240" controls="controls">
         <source src="movie.mp4" type="video/mp4" />
     </video>
To show a audio in HTML5 is similar to the above code,Just replace
 the video tag with audio tag and use an audio format instead of video
 format mentioned in the code
HTML5 Canvas
   The HTML5 canvas element uses JavaScript to draw graphics on a
   web page
   A canvas is a rectangular area, and you control every pixel of it.
   The canvas element has several methods for drawing paths, boxes,
   circles, characters, and adding images.
   A canvas element is added to the HTML5 page.
   The canvas element has no drawing abilities of its own. All drawing
   must be done inside a JavaScript

Code:
<canvas id="myCanvas" width="200" height="100">     A simple Canvas example
</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75);
</script>
HTML5 Web Storage
HTML5 offers two new objects for storing data on the client:
 LocalStorage - stores data with no time limit
 SessionStorage - stores data for one session
Earlier, this was done with cookies. Cookies are not suitable for large
amounts of data, because they are passed on by EVERY request to
the server, making it very slow and in-effective.
In HTML5, the data is NOT passed on by every server request, but
used ONLY when asked for. It is possible to store large amounts of
data without affecting the website's performance.
The data is stored in different areas for different websites, and a
website can only access data stored by itself.
HTML5 uses JavaScript to store and access the data.
HTML5 Web storage is also called ”Cookies on Steroids”.
The localStorage Object

The localStorage object stores the data with no time limit. This means
data is still available when the browser is closed and reopened, and
also instantly between tabs and windows.
An example to count the number of times a user has visited a page
Code:
<script type="text/javascript">
if (localStorage.pagecount) {
 localStorage.pagecount=Number(localStorage.pagecount) +1;
 } else {
 localStorage.pagecount=1;
 }
document.write("Visits "+ localStorage.pagecount + " time(s).");
</script>
The sessionStorage Object
The sessionStorage object stores the data for one session. The data
   is deleted when the user closes the browser window.
Data in this storage is accessible to any page from the same site
   opened in that window.
An similar example to count the number of times a user has visited a
   page, in the current session.
Code:
<script type="text/javascript">
if (sessionStorage.pagecount) {
 sessionStorage.pagecount=Number(sessionStorage.pagecount) +1;
 } else {
 sessionStorage.pagecount=1;
 } document.write("Visits "+sessionStorage.pagecount+" time(s) this
session.");
</script>
HTML5 Form Input Types

HTML5 has several new input types for forms. These new
features allow for better input control and validation.
The new input types:
   email
   url
   number
   range
   Date pickers (date, month, week, time, datetime, datetime-local)
   search
   color
HTML5 Form Input Types(Cont.)
Input Type – email
  The email type is used for input fields that should contain an e-mail
  address.
  The value of the email field is automatically validated when the form
  is submitted.
Code:
     E-mail: <input type="email" name="user_email" />
Input Type – url
  The url type is used for input fields that should contain a URL
  address.
  The value of the url field is automatically validated when the form is
  submitted.
Code:
   Homepage: <input type="url" name="user_url" />
HTML5 Form Input Types(Cont.)



         Opera 10.50’s rendering of <input type=number>.



Input Type – number
  The number type is used for input fields that should contain a
  numeric value.
  You can also set restrictions on what numbers are accepted.
Code:
  Points: <input type="number" name="points" min="1" max="10" />
HTML5 Form Input Types(Cont.)



           Google Chrome’s rendering of <input type=range>.



Input Type - range
   The range type is used for input fields that should contain a value
   from a range of numbers.The range type is displayed as a slider
   bar.
   You can also set restrictions on what numbers are accepted.
Code:
   <input type="range" name="points" min="1" max="10" />
HTML5 Form Input Types(Cont.)
Input Type - search
   The search type is used for search fields, like a site search, or
   Google search.
   The search field behaves like a regular text field.




Input Type - color                          <input type=color> on the BlackBerry.

   The color type is used for input fields that should contain a color.
   The Opera browser will allow you to select a color from a color
   picker, Google's Chrome will only allow hexadecimal color values
   to be submitted:
   Code:
         Color: <input type="color" name="user_color" />
HTML5 Form Elements
HTML5 has several new elements and attributes for forms.
The new form elements:
   <datalist>
   <keygen>
   <output>
<output> Element
   The <output> element is used for different types of output, like
   calculations or script output:
   Code:
           <form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
           <input type="range" name="a" value="50" />100
                     +<input type="number" name="b" value="50" />
                     =<output name="x" for="a b"></output>
           </form>
HTML5 Form Elements(Cont.)

<datalist> Element
   The <datalist> element specifies a list of options for an input field.
   The list is created with <option> elements inside the <datalist>.
   To bind a <datalist> to an input field, let the list attribute of the
   input field refer to the id of the datalist.
Code:
     Webpage: <input type="url" list="url_list" name="link" />
     <datalist id="url_list">
     <option label="W3Schools" value="http://www.w3schools.com" />
     <option label="Google" value="http://www.google.com" />
     <option label="Microsoft" value="http://www.microsoft.com" />
     </datalist>
HTML5 Form Elements(Cont.)
<keygen> Element
  The purpose of the <keygen> element is to provide a secure way to
  authenticate users.
  The <keygen> element is a key-pair generator. When a form is
  submitted, two keys are generated, one private and one public.
  The private key is stored on the client, and the public key is sent to
  the server. The public key could be used to generate a client
  certificate to authenticate the user in the future.
Code:
        <form action="demo_form.asp" method="get">
        Username: <input type="text" name="usr_name" />
        Encryption: <keygen name="security" />
        <input type="submit" />
        </form>
HTML5 Form Attributes
   This covers some of the new attributes for <form> and <input>.
autocomplete Attribute
   The autocomplete attribute specifies that the form or input field
   should have an autocomplete function.
   When the user starts to type in an autocomplete field, the browser
   should display options to fill in the field:
Code:
        First name: <input type="text" name="fname" autocomplete=”on”/>
autofocus Attribute
   The autofocus attribute specifies that a field should automatically
   get focus when a page is loaded.
Code:
        User name: <input type="text" name="user_name"
   autofocus="autofocus" />
HTML5 Form Attributes(Cont.)
form Attribute
   The form attribute specifies one or more forms the input field
   belongs to.
   The form attribute must refer to the id of the form it belongs to:
Code:
   <form action="demo_form.asp" method="get" id="user_form">
   First name:<input type="text" name="fname" />
   <input type="submit" /></form>
   Last name: <input type="text" name="lname" form="user_form" />

height and width Attributes
   The height and width attributes specifies the height and width of
   the image used for the input type image.
Code:
   <input type="image" src="img_submit.gif" width="24" height="24" />
HTML5 Form Attributes(Cont.)
min, max and step Attributes
   The min, max and step attributes are used to specify restrictions for
   input types containing numbers or dates.
   The max attribute specifies the maximum value allowed for the input
   field.The min attribute specifies the minimum value allowed for the
   input field.The step attribute specifies the legal number intervals for the
   input field (if step="3", legal numbers could be -3,0,3,6, etc).
Code:
   Points: <input type="number" name="points" min="0" max="10" step="3" />

multiple Attribute
   The multiple attribute specifies that multiple values can be selected for
   an input field.
Code:
   Select images: <input type="file" name="img" multiple="multiple" />
HTML5 Form Attributes(Cont.)
novalidate Attribute
   The novalidate attribute specifies that the form or input field
   should not be validated when submitted.
   If this attribute is present the form will not validate form input.
placeholder Attribute
   The placeholder attribute provides a hint that describes the
   expected value of an input field.
Code:
   <input type="search" name="user_search" placeholder="Search
   W3Schools" />
required Attribute
   The required attribute specifies that an input field must be filled
   out before submitting.
Code:
   Name: <input type="text" name="usr_name" required="required" />
Drag And Drop




                An image being Dragged and Dropped.

By default,all links, text nodes (or selections of), and image elements
are draggable. This means that you don’t have to do anything to tell
the browser they can be dragged around the page.
Our simple demo will have a drop zone and a couple of images that
you can drag into the drop zone. And when you drop them,the image
source will appear in the drop zone
Drag And Drop(Cont.)
Since there’s nothing to be done to the draggable images, you just need
to hook up the drop zone, which requires the following event handlers:
   Drag over: Tell the browser this is an element that accepts drop data.
   On drop: Once something has been dropped on the element, do
   something with the dropped data.
   Code:
       <script>
       var drop = document.getElementById(‘drop’);
       drop.ondrop = function (event) {
       this.innerHTML += ‘<p>’ + event.dataTransfer. getData(‘Text’) + ‘</p>’;
       return false;
       };
       drop.ondragover = function () { return false; };
       </script>
GEOLOCATION
The geolocation API gives us a way to locate the exact position of our
visitor.




 Google Maps detects geolocation support and adds the “locate me” functionality
The geolocation API offers two methods for getting the geo
   information from your user:
   getCurrentPosition is a one-shot method for grabbing the user’s
   current location.
   watchPosition keeps an eye on their position and keeps polling at
   regular intervals to see if their location has changed.
   watchPosition mirrors getCurrentPosition’s functionality, but also if
   the user’s position changes, it will tell your code.
Conclusion


Despite inconsistent browser implementations of its features,
HTML5 is an exciting technology for creating new and powerful
browser-based applications.
Unlike previous versions, HTML5 promises better integration of
multimedia and other applications inside the core of most Web
pages. While HTML5 adoption started off slowly, growing
evangelism from a number of leading vendors in the last six
months has spurred adoption by developers everywhere.
Thank You
References



   Introducing to HTML5 by Bruce Lawson and
    Remy Sharp.
   www.w3schools.com
   www.codeproject.com
   To check the compatibility of the browser with
    each element of HTML5, you can visit the site:
    www.html5test.com

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Forms in html5
Forms in html5Forms in html5
Forms in html5
 
Html form tag
Html form tagHtml form tag
Html form tag
 
Html forms
Html formsHtml forms
Html forms
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html css
Html cssHtml css
Html css
 
Chat php
Chat phpChat php
Chat php
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5
 
HTML5 Web Forms
HTML5 Web FormsHTML5 Web Forms
HTML5 Web Forms
 
HTML5 Form Validation
HTML5 Form ValidationHTML5 Form Validation
HTML5 Form Validation
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 
Forms With Ajax And Advanced Plugins
Forms With Ajax And Advanced PluginsForms With Ajax And Advanced Plugins
Forms With Ajax And Advanced Plugins
 
Html forms
Html formsHtml forms
Html forms
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
 
Html forms
Html formsHtml forms
Html forms
 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
 

Ähnlich wie HTML5: The Next Generation of HTML

Ähnlich wie HTML5: The Next Generation of HTML (20)

HTML5 - Quick Guide
HTML5 - Quick GuideHTML5 - Quick Guide
HTML5 - Quick Guide
 
HTML5 Refresher
HTML5 RefresherHTML5 Refresher
HTML5 Refresher
 
Html5
Html5Html5
Html5
 
php
phpphp
php
 
Chapter09
Chapter09Chapter09
Chapter09
 
HTML 5 Basics Part Three
HTML 5 Basics Part ThreeHTML 5 Basics Part Three
HTML 5 Basics Part Three
 
Html5 tags
Html5 tagsHtml5 tags
Html5 tags
 
Web Design Lecture 4.pptx
Web Design Lecture 4.pptxWeb Design Lecture 4.pptx
Web Design Lecture 4.pptx
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
gdsc-html-ppt.pptx
gdsc-html-ppt.pptxgdsc-html-ppt.pptx
gdsc-html-ppt.pptx
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Html5
Html5Html5
Html5
 
Active server pages
Active server pagesActive server pages
Active server pages
 
Unit 2
Unit 2 Unit 2
Unit 2
 
331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Rohit&kunjan
Rohit&kunjanRohit&kunjan
Rohit&kunjan
 
Html5
Html5Html5
Html5
 
Html 5
Html 5Html 5
Html 5
 
Html forms
Html formsHtml forms
Html forms
 

Kürzlich hochgeladen

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Kürzlich hochgeladen (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

HTML5: The Next Generation of HTML

  • 1. HTML5 The next generation of HTML By, Kaushik Vinay T G
  • 2. What is HTML5? HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML came in 1999. The web has changed a lot since then. HTML5 is still a work in progress. However, most modern browsers have some HTML5 support.
  • 3. New Features The canvas element for drawing The video and audio elements for media playback Better support for local offline storage New content specific elements, like article, footer, header, nav, section New form controls, like calendar, date, time, email, url, search
  • 4. HTML5 Video/Audio Until now, there has not been a standard for showing a Video/Audio on a web page. HTML5 defines a new elements which specifies a standard way to embed a video/movie on a web page: the <video> element. A standard way to embed a audio on web page: the <audio> element. Currently, there are 3 supported video formats : MP4, WebM, and Ogg. There are 3 supported audio formats:Mp3,Ogg, and Wav. To show a video in HTML5, this is all you need: Code: <video width="320" height="240" controls="controls"> <source src="movie.mp4" type="video/mp4" /> </video> To show a audio in HTML5 is similar to the above code,Just replace the video tag with audio tag and use an audio format instead of video format mentioned in the code
  • 5. HTML5 Canvas The HTML5 canvas element uses JavaScript to draw graphics on a web page A canvas is a rectangular area, and you control every pixel of it. The canvas element has several methods for drawing paths, boxes, circles, characters, and adding images. A canvas element is added to the HTML5 page. The canvas element has no drawing abilities of its own. All drawing must be done inside a JavaScript Code: <canvas id="myCanvas" width="200" height="100"> A simple Canvas example </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.fillStyle="#FF0000"; ctx.fillRect(0,0,150,75); </script>
  • 6. HTML5 Web Storage HTML5 offers two new objects for storing data on the client: LocalStorage - stores data with no time limit SessionStorage - stores data for one session Earlier, this was done with cookies. Cookies are not suitable for large amounts of data, because they are passed on by EVERY request to the server, making it very slow and in-effective. In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the website's performance. The data is stored in different areas for different websites, and a website can only access data stored by itself. HTML5 uses JavaScript to store and access the data. HTML5 Web storage is also called ”Cookies on Steroids”.
  • 7. The localStorage Object The localStorage object stores the data with no time limit. This means data is still available when the browser is closed and reopened, and also instantly between tabs and windows. An example to count the number of times a user has visited a page Code: <script type="text/javascript"> if (localStorage.pagecount) { localStorage.pagecount=Number(localStorage.pagecount) +1; } else { localStorage.pagecount=1; } document.write("Visits "+ localStorage.pagecount + " time(s)."); </script>
  • 8. The sessionStorage Object The sessionStorage object stores the data for one session. The data is deleted when the user closes the browser window. Data in this storage is accessible to any page from the same site opened in that window. An similar example to count the number of times a user has visited a page, in the current session. Code: <script type="text/javascript"> if (sessionStorage.pagecount) { sessionStorage.pagecount=Number(sessionStorage.pagecount) +1; } else { sessionStorage.pagecount=1; } document.write("Visits "+sessionStorage.pagecount+" time(s) this session."); </script>
  • 9. HTML5 Form Input Types HTML5 has several new input types for forms. These new features allow for better input control and validation. The new input types: email url number range Date pickers (date, month, week, time, datetime, datetime-local) search color
  • 10. HTML5 Form Input Types(Cont.) Input Type – email The email type is used for input fields that should contain an e-mail address. The value of the email field is automatically validated when the form is submitted. Code: E-mail: <input type="email" name="user_email" /> Input Type – url The url type is used for input fields that should contain a URL address. The value of the url field is automatically validated when the form is submitted. Code: Homepage: <input type="url" name="user_url" />
  • 11. HTML5 Form Input Types(Cont.) Opera 10.50’s rendering of <input type=number>. Input Type – number The number type is used for input fields that should contain a numeric value. You can also set restrictions on what numbers are accepted. Code: Points: <input type="number" name="points" min="1" max="10" />
  • 12. HTML5 Form Input Types(Cont.) Google Chrome’s rendering of <input type=range>. Input Type - range The range type is used for input fields that should contain a value from a range of numbers.The range type is displayed as a slider bar. You can also set restrictions on what numbers are accepted. Code: <input type="range" name="points" min="1" max="10" />
  • 13. HTML5 Form Input Types(Cont.) Input Type - search The search type is used for search fields, like a site search, or Google search. The search field behaves like a regular text field. Input Type - color <input type=color> on the BlackBerry. The color type is used for input fields that should contain a color. The Opera browser will allow you to select a color from a color picker, Google's Chrome will only allow hexadecimal color values to be submitted: Code: Color: <input type="color" name="user_color" />
  • 14. HTML5 Form Elements HTML5 has several new elements and attributes for forms. The new form elements: <datalist> <keygen> <output> <output> Element The <output> element is used for different types of output, like calculations or script output: Code: <form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0 <input type="range" name="a" value="50" />100 +<input type="number" name="b" value="50" /> =<output name="x" for="a b"></output> </form>
  • 15. HTML5 Form Elements(Cont.) <datalist> Element The <datalist> element specifies a list of options for an input field. The list is created with <option> elements inside the <datalist>. To bind a <datalist> to an input field, let the list attribute of the input field refer to the id of the datalist. Code: Webpage: <input type="url" list="url_list" name="link" /> <datalist id="url_list"> <option label="W3Schools" value="http://www.w3schools.com" /> <option label="Google" value="http://www.google.com" /> <option label="Microsoft" value="http://www.microsoft.com" /> </datalist>
  • 16. HTML5 Form Elements(Cont.) <keygen> Element The purpose of the <keygen> element is to provide a secure way to authenticate users. The <keygen> element is a key-pair generator. When a form is submitted, two keys are generated, one private and one public. The private key is stored on the client, and the public key is sent to the server. The public key could be used to generate a client certificate to authenticate the user in the future. Code: <form action="demo_form.asp" method="get"> Username: <input type="text" name="usr_name" /> Encryption: <keygen name="security" /> <input type="submit" /> </form>
  • 17. HTML5 Form Attributes This covers some of the new attributes for <form> and <input>. autocomplete Attribute The autocomplete attribute specifies that the form or input field should have an autocomplete function. When the user starts to type in an autocomplete field, the browser should display options to fill in the field: Code: First name: <input type="text" name="fname" autocomplete=”on”/> autofocus Attribute The autofocus attribute specifies that a field should automatically get focus when a page is loaded. Code: User name: <input type="text" name="user_name" autofocus="autofocus" />
  • 18. HTML5 Form Attributes(Cont.) form Attribute The form attribute specifies one or more forms the input field belongs to. The form attribute must refer to the id of the form it belongs to: Code: <form action="demo_form.asp" method="get" id="user_form"> First name:<input type="text" name="fname" /> <input type="submit" /></form> Last name: <input type="text" name="lname" form="user_form" /> height and width Attributes The height and width attributes specifies the height and width of the image used for the input type image. Code: <input type="image" src="img_submit.gif" width="24" height="24" />
  • 19. HTML5 Form Attributes(Cont.) min, max and step Attributes The min, max and step attributes are used to specify restrictions for input types containing numbers or dates. The max attribute specifies the maximum value allowed for the input field.The min attribute specifies the minimum value allowed for the input field.The step attribute specifies the legal number intervals for the input field (if step="3", legal numbers could be -3,0,3,6, etc). Code: Points: <input type="number" name="points" min="0" max="10" step="3" /> multiple Attribute The multiple attribute specifies that multiple values can be selected for an input field. Code: Select images: <input type="file" name="img" multiple="multiple" />
  • 20. HTML5 Form Attributes(Cont.) novalidate Attribute The novalidate attribute specifies that the form or input field should not be validated when submitted. If this attribute is present the form will not validate form input. placeholder Attribute The placeholder attribute provides a hint that describes the expected value of an input field. Code: <input type="search" name="user_search" placeholder="Search W3Schools" /> required Attribute The required attribute specifies that an input field must be filled out before submitting. Code: Name: <input type="text" name="usr_name" required="required" />
  • 21. Drag And Drop An image being Dragged and Dropped. By default,all links, text nodes (or selections of), and image elements are draggable. This means that you don’t have to do anything to tell the browser they can be dragged around the page. Our simple demo will have a drop zone and a couple of images that you can drag into the drop zone. And when you drop them,the image source will appear in the drop zone
  • 22. Drag And Drop(Cont.) Since there’s nothing to be done to the draggable images, you just need to hook up the drop zone, which requires the following event handlers: Drag over: Tell the browser this is an element that accepts drop data. On drop: Once something has been dropped on the element, do something with the dropped data. Code: <script> var drop = document.getElementById(‘drop’); drop.ondrop = function (event) { this.innerHTML += ‘<p>’ + event.dataTransfer. getData(‘Text’) + ‘</p>’; return false; }; drop.ondragover = function () { return false; }; </script>
  • 23. GEOLOCATION The geolocation API gives us a way to locate the exact position of our visitor. Google Maps detects geolocation support and adds the “locate me” functionality The geolocation API offers two methods for getting the geo information from your user: getCurrentPosition is a one-shot method for grabbing the user’s current location. watchPosition keeps an eye on their position and keeps polling at regular intervals to see if their location has changed. watchPosition mirrors getCurrentPosition’s functionality, but also if the user’s position changes, it will tell your code.
  • 24. Conclusion Despite inconsistent browser implementations of its features, HTML5 is an exciting technology for creating new and powerful browser-based applications. Unlike previous versions, HTML5 promises better integration of multimedia and other applications inside the core of most Web pages. While HTML5 adoption started off slowly, growing evangelism from a number of leading vendors in the last six months has spurred adoption by developers everywhere.
  • 26. References  Introducing to HTML5 by Bruce Lawson and Remy Sharp.  www.w3schools.com  www.codeproject.com  To check the compatibility of the browser with each element of HTML5, you can visit the site: www.html5test.com