Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect whether HTML5 History supported or not

How can I check if the browser you are using supports the HTML5 history api?

As you can see here http://caniuse.com/#search=history only chrome +ff4 and several others supports this and I wish to do something else if they cant support this.

How can I make some kind of an if statement for this checking?

like image 963
Karem Avatar asked Jan 16 '11 21:01

Karem


People also ask

How can I tell if HTML5 is supported?

The getContext method is checked by accessing it on the created input object. The result of this expression is checked with an if-statement. If the result is true, it means that HTML5 is supported by the browser.

Which browser supports HTML5 in latest version?

HTML5 is now compatible with all popular browsers (Chrome, Firefox, Safari, IE9, and Opera) and with the introduction of DOCTYPE, it is even possible to have a few HTML features in older versions of Internet Explorer too.

What is HTML5 history API?

The HTML5 History API gives developers the ability to modify a website's URL without a full page refresh. This is particularly useful for loading portions of a page with JavaScript, such that the content is significantly different and warrants a new URL. Here's an example.


1 Answers

if (window.history && window.history.pushState) 

See also this All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything

like image 191
Gaurav Avatar answered Oct 07 '22 13:10

Gaurav