Quantcast
Channel: Interview Questions – Web Development Tutorial
Viewing all articles
Browse latest Browse all 26

a MUST HAVE HTML5 Interview Questions and Answers – Part 2

$
0
0

It’s continuation of my previous post on HTML5 Interview Questions with detailed answers. In previous post we started to set a base knowledge for latest HTML standard i.e HTML5. Later discussing about HTML5 new elements and more details about Graphics related concepts including SVG and Canvas.

I’ll recommend to read the following posts on HTML5 Interview Questions:

Here we will continue exploring more HTML5 concepts with the help of Interview Questions.

HTML5 Interview Questions List – Part 2

What is a placeholder attribute in HTML5?

New placeholder attribute in HTML5 acts as a hint for input field value. It provides a kind of facilitating text for a description or expected type of value or an expected format of the value. For example, “Student Name” hints for a textbox expecting student name or “000-0000000″ hints for an expected phone number format etc.

<input type=”text” name=”studentName” placeholder=”Student Name” >HTML5 placeholder attributeplaceholder attribute is applicable to following input types:

  • text
  • password
  • email
  • url
  • search
  • tel

Back to top

What is a draggable attribute in HTML5?

In order to make an element draggable, HTML5 introduces draggable attribute. By default, Links and Images are draggable. If we want to make a paragraph or a span element draggable, will set the draggable attribute of that specific element to true as:

<span draggable=”true”>
Back to top

Is it possible to get the geographical location of a user using HTML5?

Yes. It’s quiet possible to get the geographical location of a user using HTML5. As it has user’s privacy concerns so user’s approval needed. As we discussed in previous post about new HTML5 API including Media API, Text Track API, Application Cache, User Interaction, Data Transfer API, Command API etc: HTML5 introduced new Geolocation API for locating a user’s position.

In order to get user position, getCurrentPosition() method is used as:

                  navigator.geolocation.getCurrentPosition(show_map);

Above code simply provides an idea how we can retrieve geographical location of a user. But while providing professional implementation, we will get user approval and also handle errors accordingly.HTML5 GeoLocation API
Back to top

What is Application Cache in HTML5?

HTML5 facilitates us to make offline version of complete or partial website contents including HTML files, JavaScript, CSS and images etc. Keeping an offline version speeds up site’s performance. Before HTML5, browsers were also caching contents but user’s have to visit all those HTML pages.
Back to top

How to enable Application Cache in HTML5?

In order to achieve Application Cache feature in HTML5, a manifest file is used as follows:

<!doctype html>
<html manifest=”test.appcache”>
…..
</html>

Manifest file is basically a text file that dictates what needs to be cache or not if Application Cache is enabled. Followings are the four main sections of a manifest file where CACHE MANIFEST is the only required section:

  • CACHE MANIFEST
  • CACHE
  • NETWORK
  • FALLBACK

HTML5 Application Cache ManifestBack to top

What is an HTML5 Web Worker?

Normally if some script is executing in an HTML page, the page remains unresponsive until the scripts execution stops. But an HTML5 web worker is a script (i.e. JavaScript) that keeps executing in background. At the same time user can interact with the page and will not feel any performance degradation.HTML5 Web Worker

HTML5 web worker normally exists in external files and used for long-running CPU intensive tasks but without affecting the User Interface or other scripts.
Back to top

What are the limitations of HTML5 Web Worker?

HTML5 Web worker seems to be very handy in many scenarios (especially for CPU intensive tasks) but it has certain limitations. Few JavaScript objects are not accessible to HTML5 web worker as:

  • parent object
  • window object
  • document object

Back to top

What is localStorage in HTML5?

In order to store data locally, HTML5 supports for localStorage object. It stores data for a longer time in a client browser but it doesn’t lost data even if browser is closed. This purpose was achieved previously with the help of Cookies.

localStorage has following advantages as compared to using Cookies:

  • localStorage has better performance even for larger amount of data.
  • localStorage can store data for longer period.
  • localStorage is more secure as compared to cookies.

Back to top

What about browser support for localStorage in HTML5?

Browser support for localStorage in HTML5 is as follows:

  • Chrome 4
  • IE 8+
  • firefox 3.5+
  • Safari 4
  • Opera 10.5

Back to top

Free Online Test


<<< Previous: HTML5 Interview Questions – Part 1

Other Related Articles:

Top 10 Interview Questions and Answers Series:

The post a MUST HAVE HTML5 Interview Questions and Answers – Part 2 appeared first on Web Development Tutorial.


Viewing all articles
Browse latest Browse all 26

Trending Articles