How do I stop HTML Tidy from removing the closing tag?

Currently HTML Tidy changes any empty HTML tag and concatenates them into one, for example:

<script src="somescript.js"></script>

      

Included in:

<script src="somescript.js" />

      

This is a problem because the inclusion of javascript files in the "head" of my HTML now does not work in some kind of browser that explicitly requires this closing tag to be separated from the open tag.

How can I stop Tidy from removing those closing tags?

0


a source to share


2 answers


Try to insert some content inside the element <script>

, content that won't break the browser but that will prevent the Tidy tags from crashing. Something like spaces, or &nbsp;

, or javascript comment.



+1


a source


Have you defined a DOCTYPE for your HTML?



Wrapping the close tag in a single tag should work for valid Xhtml, but might break your old html.

0


a source







All Articles