Due to some circumstances, this blog is now up for sale, for more enquires contact: Plushista@gmail.com
RealcomBiz
Pin It

Detection Techniques to Check Browser Support For HTML5 Features

by Unknown | Saturday, October 18, 2014 | 39 Comments

Any website is built with a common goal in mind: to make it work according to the latest specifications and web trends. Since the mobile Internet usage is growing with each passing day, it is becoming needful for site owners to develop a site that is optimized for mobile users. And HTML5 provides the potential to build mobile websites. This is why, HTML5 web development is becoming the most popular web trend used by webmasters around the world.



HTML5 introduced a lot of new and cool functionalities including some great semantic elements, audio and video support and the canvas tag. However, some old browsers don't provide support for HTML5, and thus you may think how to adopt HTML5 if your users don’t have HTML5-compatible browsers. But that's not what you should be thinking, as it is a misleading thought. Remember that the browsers that support HTML5 means that they support different features of it; and rather than detecting whether “browsers support HTML5”, you should detect if the new HTML5 functionality is supported in the browsers or not.

This post will help you explore how to detect browser support for the new HTML5 elements.


An Overview of the Detection Techniques

When a web page is rendered by a web browser, a Document Object Model (DOM) is created. A DOM is a collection of objects that specifies the HTML elements by a different object. Some of those elements include <p> tag, <span> tag and a few other tags. All of the DOM objects boasts a common set of properties, however certain objects may have more properties compared to others. Most importantly, browsers that support HTML5 features will contains some DOM objects having unique properties. And so, looking at the DOM will most likely help you know about the features that the browsers support.

Below is a list of four basic techniques that will help you detect whether a browser supports HTML5 feature or not.


1. Technique to identify whether a particular property exists on a “global object” such as window or navigator. For example, below is a function that helps to verify whether the browser supports geolocation or not.

function supports_geolocation() {
return !!navigator.geolocation;
}

2. Technique that allows users to create an element, and then test whether a certain property is governed by that element. This technique is quite useful to check for canvas support.

function supports_canvas() {
return !!document.createElement('canvas').getContext;
}

3. Third technique also help create an element, and verify if a certain method is characterized by that element or not. Next, call the method to find out the value it returns. For example, using this technique you can test video formats that are supported by a browser.

function supports_x123_baseline_video() {
if (!supports_video()) { return false; }
var m = document.createElement("video");
return m.canPlayType('video/mp3; codecs="avc1.42E01E, mp3a.40.2"');
}

4. You can use a detection technique that let you create an element, which is followed by setting a property for a certain value, and then testing whether the property has retained its value or not. For example, check out which <input> types are supported. 

var v = document.createElement("input_value");
v.setAttribute("type", "color");
return v.type !== "text";


A Look Into Modernizr – HTML5 Feature Detection Library

Modernizr JavaScript library is touted as the most viable solution for detecting support for HTML5 features. It uses the advanced JavaScript object detection techniques to check whether the current browser has implemented HTML5 and CSS3 features or not. This feature detection library makes it convenient for you to discover what can and cannot do with your current browser.

In order to use this library, you will have to incorporate the below mentioned <script> element in your page <head> section:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Detect Browser Support for HTML5 Features</title>
  <script src="modernizr.min.js"></script>
</head>
<body>
  ...
</body>
</html>

You do not need to run Modernizr manually and there's no modernizr_init() function that you'll need to call. Rather it runs automatically and creates a global object called as “Modernizr” that uses boolean properties for each feature that it tests. For example, in case your current browser supports the “canvas API” HTML5 feature, then the Modernizr.canvas property will return true. But, if the browser doesn't support canvas API, then the Modernizr.canvas property will return false.

if (Modernizr.canvas) {
  // draw some shapes!
} else {
  // native canvas support is not available
}

Note: Since the Modernizr detection library version keeps on updating, make sure to use the latest one to get optimal results.


Let's Wrap Up!

HTML5 is widely used for web development today, especially it is used by business entities that want to build a functional website that help them stay competitive in today's mobile marketplace. However, a lot of users still don't use browsers that support HTML5 functionality. And thus, while developing in HTML5 it becomes imperative to test whether the browser that your users are using supports the HTML5 features or not.



Amy Brown is a web developer by profession, a writer by hobby and works for WordPrax Ltd., a WordPress development services company. She loves sharing information regarding WordPress customization tips & tricks.



Go Social:

Subscribe For Free Updates!

*Please confirm the email sent to your inbox after clicking "Sign Up!".

39 comments : Post Yours! Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. This wonderful post is in fact so interesting and comic, I really loved this. Thanks intended for sharing this information.
    instagram shoutouts

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Get All the updates about t20 wc 2016. Livescore t20 wc 2016. Match details and match predictions icc t20 wc livescore

    ReplyDelete
  4. France Ligue 2 Live Stream
    Watch live football streaming online at livefootballontv1.com. Find out a complete tv guide of today's popular matches in Europe.

    ReplyDelete
  5. good It is certainly incredibly simple to download video lessons to your Product. this page that users happen to be demonstrating consequently Vidmate APK Android nice.

    ReplyDelete
  6. good USB line interconnection can be the simply one approach to copy data files this page Only believe about the difficulties that you get through SHAREit on Computer nice.

    ReplyDelete
  7. good introduce in Snapchat, 2015 revisions and because filters on snapchat The function is usually to become acquired as great.

    ReplyDelete
  8. good Now you can easily watch your favorite movies this page After accessing the showbox apk record track down ShowBox Download Free nice.

    ReplyDelete
  9. This is very nice one and gives depth information. Thanks and keep posting! Thanks again for the blog article . Much thanks again. Great. hotmail sign in

    ReplyDelete
  10. Great Post! Learn some new tactics today. Thanks for sharing.

    ReplyDelete
  11. You can receive or send emails to friends and colleagues as well as easy access to the application the Microsoft website. Let's create a separate account for her right now.
    hotmail login | create new hotmail account
    Creating a Gmail account is quick and easy. You can follow the tutorial to sign up Gmail here
    gmail login | google drive login


    ReplyDelete
  12. good Download Google Duo for Apple pc Computer here Google Duo for iOS but also sometimes it can come to be a aggravating nice.

    ReplyDelete
  13. good Follow the on display directions to complete the procedure. Nox App Player Nox Application Gamer works with all OS versions. nice.

    ReplyDelete
  14. good than main Slack client for Linux. I had an issue with the slack windows to the Windows Store or a Windows Phone application in the future nice.

    ReplyDelete
  15. awesome you are picking is extremely lightweight which will certainly Best Crib Mattress Reviews If it is a firm cushion it ought to not fix to the shape of your hand, instead nice.

    ReplyDelete
  16. good consistently maintains seeking any type of video imobdroapp.com which individuals are going to love without a doubt nice.

    ReplyDelete
  17. good all the individuals. Minor insects have actually been dealt with. Mobdro for XBMC to download Mobdro Application for apple iphone nice.

    ReplyDelete
  18. Great fascinating to consume time Mobile video https://imobdroapp.com certainly get all the functions of a premium TELEVISION application free Fine.

    ReplyDelete
  19. Very good article. I certainly love this site.
    abcya

    ReplyDelete
  20. Thank you for sharing this article with us!
    slither io

    ReplyDelete
  21. Also utilize various other options for Bluestacks like mobdro apk shows, movies, tunes and also far more on larger screen.

    ReplyDelete
  22. Thank you for sharing! The problem seems simple, but through your pen, it impresses me!
    bloxorz

    ReplyDelete
  23. Below we share the guide to download and mount this Apk on your Mini Militia Co-op and also Survival settings. Fire a multitude of weapon.

    ReplyDelete
  24. Your topic is very nice and helpful to us ... Thank you for the information you wrote.
    usps tracking

    ReplyDelete
  25. Thank you so much for ding the impressive job here, everyone will surely like your post.
    I really enjoy reading and also appreciate your work.
    jailbreak iOS 10.3
    cydia sources

    ReplyDelete
  26. you could maintain Tutu helper on the side for your additional app demands. click here the APK documents. Inspect APK and Download folders.

    ReplyDelete
  27. Nice And Informative Website. Please Keep Continue Such Kind Of Effort. I Shared Your Post With My Friends Also. Are You Looking For Independent Escort Service In Mumbai? We Deal In High Class Mumbai Models And Beautiful mumbai call girls. We Are Available To Serve You 24 X 7. Contact Us For Booking Ph- 09987215552

    ReplyDelete
  28. Independent Escort Service In Mumbai, Call - +91- 9004009481
    Hi friends are you looking the best escort service in Mumbai? Contact me, my name is Ritu Sharma. I am an independent Mumbai escort girl. I provide the best service in low cost. I am compostable to move at your own place like your room, hotel etc. I am glad to tell you I am available 24 X 7 for you. My personal no- +91- 9004009481
    I am fully professional escort girl. I am trained completely in my profession. I understand you personal feeling and needs. Once you take my service you call me again. Apart me in my profession I have some beautiful Mumbai models also in low price. You can take enjoy with me short time, and long time. Just you need to call me at my personal number to book my VIP services.
    Reach To A Safe Juncture With The Escort Service In Mumbai
    Have you become bore with your life? Is there no enjoyment and fun? There is one solution with me. Do you know what? The escort service in Mumbai is the one. You can find very pretty girls in the website. Are you a resident of Mumbai? Or do you come Mumbai often for official purpose? You can always find these escorts. Just a phone call and she will be ready to serve you. But they are in a high demand. You need to make your booking in an advance. But, we have wide collection of escorts. Choosing from that list is possible too. Are you eager to see them? The website can give you a vivid view. Also, you can visit the agency of escort service in Mumbai. All of them will be present there.
    Perfect Companion With Escort Service In Mumbai
    We, human being are social beings. We cannot stay alone. A partner is always required. For every male, a female partner is needed. Life become meaningless without such companion. You can now take the Mumbai escorts here and there while you are out. The escort service in Mumbai has great flexibility. Some of the escort agency will allow the time flexibility as well. There is special rate for each escort. Some girls are extremely demanded by clients. Thus, their rate is high. If you want to get the best one of the lot, its is the time to hurry up.
    Escort Service In Mumbai- English Speaking
    Can you imagine, even escorts can speak in English? Proper training is given to all of them at the very early stage. Some of the escorts already know English language right from the time they were recruited. But, some of them were not aware of this language. Thus, special training is provided to them. The spoken English is taught o them so that they can speak with all types of clients. Thus, they can entertain the international clients. Sometimes, there are business clients who have come from other parts of the world. How do they get entertained? escort service in Mumbai will be the remedy.

    ReplyDelete

Recent Posts

Let's Connect

Site Links

Copyright © 2014 RealcomBiz. All Rights Reserved.
Powered by Blogger