Search code examples
javascripthtmlvalidationgoogle-chrometizen

How to validate html page and fix it with javascript


I recently ran into the problem related to html document validation. It seems to me that Chrome is pretty clever and can fix most of the mistakes.

In my case I receive raw html file with mistakes and I need to load it on Sumsung TV powered by Tizen 2.4. Unfortunately it doesn't provide the same features as Chrome so I need to fix documents by myself. What do you think about html validation with help of javascript (My app is written in js).

  1. Download html page and save it

    1.2. Download all the related files (css,js,images) and fix links

  2. fix all the problems (use some library, or may be there are some good validators, but it is better to do offline)
  3. Open document

Solution

  • You can use a linter; a quick search on Github showed up some JavaScript-powered HTML-linters: