Here we will continue exploring more HTML5 concepts with the help of Interview Questions.
HTML5 Interview Questions
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” >placeholder attribute is applicable to following input types:
- text
- password
- url
- search
- tel
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”>
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 requires. 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.
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.
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>
<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.
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 normally exists in external files and used for long-running CPU intensive tasks but without affecting the User Interface or other scripts.
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
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.
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
You learned something good about HTML5. Test your HTML5 knowledge, take a simple free
Source from
http://www.webdevelopmenthelp.net/2014/09/html5-interview-questions-and-answers-part2.html
No comments :
Post a Comment