How does a Web browser differentiate between HTML5 and HTML4?
Asked
Active
Viewed 2,011 times
6
-
1possible duplicate of [What's the key difference between HTML 4 and HTML 5?](http://stackoverflow.com/questions/134727/whats-the-key-difference-between-html-4-and-html-5) – dokaspar Oct 27 '14 at 22:06
-
1See [Don't forget to add a doctype](http://www.w3.org/QA/Tips/Doctype) – Boaz Oct 27 '14 at 22:06
-
So the answer is : DTD declaration ? – AHmedRef Oct 27 '14 at 22:07
-
1@Dominik The OP seems to be asking *how the browser knows* the difference between the two, not *what is* the difference between them. – Boaz Oct 27 '14 at 22:07
-
yeah that's my question – AHmedRef Oct 27 '14 at 22:09
-
1@AHmédNet Yes, the browser determines the markup's version according to the doctype declaration. – Boaz Oct 27 '14 at 22:09
-
Thank's @ Boaz and another thanks to @Dominik – AHmedRef Oct 27 '14 at 22:11
-
1@Boaz: good point, the two questions are really not duplicates. – dokaspar Oct 27 '14 at 22:12
-
Browsers don't differentiate between HTML5 and HTML4. – Alohci Oct 28 '14 at 00:08
1 Answers
4
According to w3schools, the following DOCTYPE defines a document as HTML5:
<!DOCTYPE html>
And the three types of HTML4 are defined by the following DOCTYPE declarations:
HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

dokaspar
- 8,186
- 14
- 70
- 98