HTML5 Interview Questions
1 .
What is a Web Worker in Html5?
A web worker in HTML5 is a script that runs on a separate thread in the background without the need for the main web page to wait for it to complete. Web Workers enable long tasks to be achieved without keeping the web page responsive.
2 .
What does WHATWG stand for in the world of HTML5?
The WHATWG stands for Web Hypertext Application Technology Working Group in HTML5. This is an organization which both develops and maintains the HTML and API for web applications.
3 .
What is Meta tags? Why it is used?
HTML5 has introduced a way to let designers take charge of the web page area that is visible to the users through tags. The meta tag tells information related to an HTML document. Some of the examples are Link, Style and Title. With meta tag, we can add meta ketwords, meta description and meta title that helps for SEO Purposes.
4 .
Can we use multiple <header> and <footer> elements in html5?
Yes. Both <header> and <footer> tags are made to fulfill their respective purposes in relation to their parent “section”. So not only can you use both header and footer elements on a page in HTML5, but you can also use both in every <article> or <section>. A <header> tag must be present for all articles, sections, and pages, although a <footer> tag is not necessary.
5 .
What is a manifest file in HTML?
In HTML 5, the manifest file is a normal text file used for listing resources in the browser which are to be cached for offline access. It also helps in loading resources faster and reducing server load time.
6 .
Please explain how to indicate the character set being used by a document in HTML5?
The character set being used by an HTML5 document is indicated using the charset attribute of a <meta> tag inside the <head> element of the HTML5 document :
 
<!DOCTYPE html>
<html>
  <head>
     …
     ...
    <meta charset="UTF-8">
     …
     …
  </head>
  <body>
   ----
   ----
  </body>
</html>
7 .
What are the useful API in HTML5?
Some of the useful APIs in HTML5 are :
 
Fetch : Fetch has made Http requests easier than it was with XMLHttpRequest.
Battery status : checks the battery status of the device.
Geolocation : tells the device location.
Clipboard : copy the contents to the clipboard.
Forms : new types have been added for validation and rendering.
Drag and drop : easily drag and drop items in the app.
Screen orientation : Checks the device’s screen orientation.
Web audio : Process audio on the client-side.
Internalization : International formatting and string comparison.
Web sockets : real-time communication between server and client.
8 .
What is the use of URL input control in Web form 2.0?
This control accepts only URL value and is used for input fields that need a URL address. It will not accept any other values like text input. The accepted formats are : http://www.<webaddr> or http://<webaddr>
9 .
What is the server-sent events in HTML5?
The events that flow from the webserver to the browsers are called server-sent events. DOM events can be continuously pushed from the webserver to the browser of a user. To use a server-sent event (SSE), you should add an <eventsource> element to the document. The src attribute of this element describes the HTTP connection location, which sends a data stream having the events.
 
Example : <eventsource src = "/cgi-bin/myfile.cgi" />
10 .
What is Vibration API in HTML5?
Vibration is a simple, nice way of alert when you get a new message or a phone call. It is especially useful when you are in a noisy environment or the place where you feel the ringing would be a distraction to others.
 
It is interesting to know that HTML5 is now providing us to play with the vibration on the devices but the HTML5 Vibrate API supports only the recent version of Firefox & Chrome.
 
To check the vibration, API support in browsers as shown below,

navigator.vibrate = navigator.vibrate || navigator.mozVibrate ||  
navigator.webkitVibrate || navigator.msVibrate;  
if (navigator.vibrate) {  
   // supports vibration API.  
}  

Vibration Syntax : Vibration basic syntax is,
 
navigator.vibrate(long | [long]);
 
The vibrate function accepts milliseconds or an array of milliseconds.
 
Example
// vibrate for 1000 ms  
navigator.vibrate(1000);  
// same like above but in array of ms  
navigator.vibrate([1000]);  
In the above examples, we are setting the device to vibrate 1000 milliseconds.