Delete Your Code #3: shorter script and style tags

delete your code, development Add comments

At my previous job a team leader was a firm believer that <script> tag must be always written in a full form like:

<script type="text/javascript">

When you have lots of javascript pieces, it becomes exhausting.

Good news, there is a way to tell to browser, that default script language is JavaScript.

To do that, inlcude a special META-tag in the HEAD of your HTML document. So if you have an inline JavaScript code for a onclick attribute of a tag, browser has no doubts it’s JavaScript.

Anyway, I include these lines in my projects HTML:

<meta http-equiv="Content-Script-Type" content="text/javascript" />

After that you can have just this:


By the way, since it’s http-equiv stuff, you can set it at server side.

P.S. There is the same trick for CSS, but it’s seems there are no alternatives to write styles, so it is useless.

One Response to “Delete Your Code #3: shorter script and style tags”

  1. inst Says:

    Nice trick. Didn’t know.

    What browsers does it works with? Versions?

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in