Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

What values of HTML script's type attribute are supported?

  • 7 replies
  • 1 has this problem
  • 2 views
  • Last reply by user293

more options

RE: <script type="...some type..." src=".... somewhere ...."></script> (SCRIPT is uppercase in HTML 4, lowercase in XHTML) Specifications say about type attribute: "This attribute specifies the scripting language of the element’s contents and overrides the default scripting language".

JavaScript (aka ECMAScript) is supported and most widely used; in fact I run both inline and .js scripts.

Where can I find, without looking at Firefox source programs, what values are supported? Just think of a script written in C language, or in Linux shell, or whatever else. If i write <script type="abcd"> then this weird value is simply ignored.

Thanks, regards

RE: <script type="...some type..." src=".... somewhere ...."></script> (SCRIPT is uppercase in HTML 4, lowercase in XHTML) Specifications say about type attribute: "This attribute specifies the scripting language of the element’s contents and overrides the default scripting language". JavaScript (aka ECMAScript) is supported and most widely used; in fact I run both inline and .js scripts. Where can I find, without looking at Firefox source programs, what values are supported? Just think of a script written in C language, or in Linux shell, or whatever else. If i write <script type="abcd"> then this weird value is simply ignored. Thanks, regards

All Replies (7)

more options

Hi MassimoR, thank you for making sure that what you are developing in supported by Firefox. It sound like you are looking for general deloper information and looking for a place to find information such as what you have asked before. The best place to find what Firefox supports is on the Mozilla developer network. I have provided the link to you. I hope you are able to find the information that you are looking for.

more options

Thank you for your reply. I had already checked there, eg https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script but it only gives a partial answer. There are two kind of scripts: inline and external (ie with src="" attribute). Inline ones are interpreted, so it is vital to know what types can be interpreted by a given release of Firefox. Such an information is not provided, or at least I have not been able to find it. Moreover, there is no diagnostic for plainly invalid types. Should I post the same question on the developer network? regards Massimo

more options

MassimoR said

Thank you for your reply. I had already checked there, eg https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script but it only gives a partial answer. There are two kind of scripts: inline and external (ie with src="" attribute). Inline ones are interpreted, so it is vital to know what types can be interpreted by a given release of Firefox. Such an information is not provided, or at least I have not been able to find it. Moreover, there is no diagnostic for plainly invalid types. Should I post the same question on the developer network? regards Massimo

That is weird. As I am sure you know in HTML the case you code in should not mater. Sure, it is considered to be "proper" to code in lower case but it should not mater. Of the top of my head I only know the basics on this subject. I am conducting further research on the subject and I have reached out to others. You will be receiving a definitive answer soon.

more options

Case is NOT a problem. Just to be precise, I mentioned that we are supposed to code elements in uppercase with HTML 4 and lowercase in XHTML. However this has nothing to do with my problem, ie what values of attribute *type* for an element *script* are supported by Mozilla Firefox. JavaScript/ECMAScript is taken for granted. What else can we do? regards Massimo

more options

Hi Massimo,

In addition to specifying text/javacript, text/ecmascript, application/javascript and application/ecmascript, you can also specify a specific version of the javascript spec, ie application/javascript;version=1.8.

There is no direct support for languages other than java/ecmascript, however it is possible to write javascript-based compilers for other languages like C. This article has an example: https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Rosetta

It's probably worth stating that this work is highly experimental. If you're looking to write a web app that people will actually use, it's far, far better to use javascript in the browser and execute any other programming on the server side. https://en.wikipedia.org/wiki/Server-side_scripting

There are also widely used tools like jquery which, while not allowing you to use a different language, do introduce new commands which make javascript easier to code and more powerful. https://en.wikipedia.org/wiki/JQuery

I hope this is a helpful start.

Modified by jayelbe

more options

Thank you for your reply. In fact I am looking to a couple of different things. ONE. Is there any documentation save from reading Firefox sources - I'm going to do exactly that sooner than later - in order to know what script types are supported? Those you mentioned are fine, however I believe there must be sort of a list, perhaps just a few IFs. TWO. I read somewhere that it should be possible to run a script written in local system shell, client side of course, and that script should be of type "text/x-sh". Is it true? On my Linux PC it doesn't work but it could be my fault.

So I need to look closely at Firefox. I never browsed my browser's inside: now I find no alternatives. In case of success I'll post and share the results.

more options

The various types of javascript (those mentioned above) are the only supported script types in any browser (as far as I know). You can't run a script written in a language other than javascript in a webpage.