How to identify HTML5
HtmlHtml Problem Overview
Is there anyway to determine whether an HTML file was written in HTML5?
Html Solutions
Solution 1 - Html
oversimplified
If it uses an HTML5 doctype, it's HTML5.
<!DOCTYPE html>
Solution 2 - Html
HTML 5 websites will not have a reference to the DTD in the doctype. Thus, the doctype tag at the top of the file will look like this:
<!DOCTYPE html>
Instead of one of these:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN""http://www.w3.org/TR/html4/frameset.dtd">
You could also check if any HTML5 tags are used...
Solution 3 - Html
-
Check
<!DOCTYPE html>
at the start of the fileA blank HTML5 page -
Detect certain HTML5 only elements such as Canvas.
Solution 4 - Html
If a page uses the HTML5 doctype (<!DOCTYPE html>)
, you can determine it as a html5.