Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 vs JavaScript [duplicate]

Before anyone loses their mind that I'm "comparing" those two, please hear me out first.

So, I'm quite interested in the new wonderful features that are available recently, with the help of new standards: localstorage, sessionstorage, geolocations, offline web applications, History API etc. Now, as it can be clearly seen, most of these features are accessed via JavaScript. But when I try to find more about them, it's all related to HTML5.

So, this is why I'm asking, am I not understanding something correctly or are the two terms being widely mixed?

like image 361
None None Avatar asked Nov 25 '13 19:11

None None


People also ask

Are HTML5 and JavaScript the same?

Key Differences Between HTML5 and JavaScriptHTML is a Markup Language of the web, whereas Javascript is a most advanced, dynamic scripting & interpreted programming language. HTML5 is used to create the basic structure and presenting content in WWW, but Javascript is a fundamental part of HTML5.

Is HTML5 replacing JavaScript?

Talking about JavaScript, it's interesting to note that HTML5 will replace the JavaScript APIs in HTML4 documents. Of course, the end-user will not notice that. With HTML5 and JavaScript combined, your web pages become dynamic and well-supported by web browsers, while your content can be made to look lively and fresh.

What is difference between HTML CSS and JavaScript?

HTML provides the basic structure of sites, which is enhanced and modified by other technologies like CSS and JavaScript. CSS is used to control presentation, formatting, and layout. JavaScript is used to control the behavior of different elements.

What is HTML5 vs HTML?

Hypertext Markup Language (HTML) is the primary language for developing web pages. HTML5 is a new version of HTML with new functionalities with markup language with Internet technologies. HTML does not have support for video and audio but, HTML5 supports both video and audio.


3 Answers

The "clean" answer, which is now becoming blurred due to the scope creep of the HTML standard, is that HTML is a markup language - which annotates the content of a web page, and javascript is a scripting language which is used to add client-side interactivity to a web page.

The reality is that the HTML5 standard now specifies many related technologies to web pages that previously would have required extra scripting or 3rd party plugins to use on a page. The HTML5 standard attempts to bring all commonly included content types and interactivity into the markup language and the browser so they can be taken for granted by your web page.

This doesn't remove the need for a scripting language such as javascript though. There will always be custom interactivity that developers will need to script into a page, but many common interactions that were coded over and over again are now baked into the HTML5 standard.

like image 161
Bork Blatt Avatar answered Oct 20 '22 09:10

Bork Blatt


I think it would be better to say that they are not competing technologies instead they are both complementary technologies. HTML provides the primary structure (and layout to a degree) of a website wheres JavaScript provides the majority of the interactivity.

No web page can be made without the help of HTML. And Javascript provides the interactivity.

But when I try to find more about them, it's all related to HTML5.

Yes that is true as mikerobi explained in this related question that Javascript is referred as HTML5 technology and HTML5 is the next generation of HTML.

The wiki has few points for HTML5 which are good to be listed:

Markup

There is also a renewed emphasis on the importance of DOM scripting (e.g., JavaScript) in Web behavior.

New APIs

In addition to specifying markup, HTML5 specifies scripting application programming interfaces (APIs) that can be used with JavaScript.[36]

Also you will find that Either JavaScript or CSS3 is necessary for animating HTML elements. Animation is also possible using JavaScript and HTML

like image 29
Rahul Tripathi Avatar answered Oct 20 '22 07:10

Rahul Tripathi


You can think of HTML5 not as another iteration of the HTML markup language, but a collection of technologies, of which HTML is part of. Broadly, I think of HTML5 as "HTML + JavaScript + CSS", though even that doesn't capture the whole picture.

It is unfortunate, in my mind, that HTML5 doesn't refer specifically to HTML. If I were the W3C, I would have branded the ecosystem of technologies "Web5" or something, which included a new HTML specification. But I digress.

My favorite introduction to HTML5, Mark Pilgrim's free Dive into HTML5, explains it well int the introduction chapter.

One important thing to realize is that JavaScript is just a programming language. While it was forged as a browser-based language, it's use as a general-purpose language is taking off, mainly thanks to Node. So if you look at it in that light, it doesn't make sense to think about local storage, session storage, geolocation, etc., as being features of the language, because these features have little to no meaning outside of the browser. (One could imagine a situation where a Node server might need geolocation, but it's a stretch....).

Anyway, it's right and proper that the "API cloud" that makes up HTML5 is specific to HTML5, and not part of the JavaScript language.

like image 33
Ethan Brown Avatar answered Oct 20 '22 09:10

Ethan Brown