Reputation: 26908
I know that IE could run VBScript and JScript, but I want cross-browser things that use another language than JavaScript, so that I wrote this:
<script src='bla.rb' type='text/ruby'></script>
<script src='bla.coffee' type='text/coffescript'></script>
<script src='bla.ics' type='text/icedcoffescript'></script>
It would run normally. How to make these tags works?
Upvotes: 3
Views: 3436
Reputation: 31850
There are many languages that can be compiled into JavaScript, including C, C++, Python, PHP, and several others.
There are also several implementations of virtual machines for other languages in JavaScript, including DoppioJVM for JVM languages and JSIL for .NET programming languages.
Upvotes: 0
Reputation:
Ruby: Maybe? Not sure how far along this project is, but it does exist.
(Iced)CoffeeScript: Yes. But you have to load one additional JavaScript file as the CoffeeScript compiler.
Upvotes: 2
Reputation:
Python can be used if you compile CPython to JavaScript using Emscripten. Maybe you can do the same with Ruby.
Besides Emscripten, there are languages that compile to JavaScript, such as CoffeeScript and Fay. You could also write your own VM in JavaScript and write a compiler for your favourite language that targets that VM, of course.
In the end, the browser itself can only interpret JavaScript.
Upvotes: 3
Reputation: 70160
No, you cannot rely on the presence of any of these other languages in the majority of browsers. You can potentially ask a user to instal a new language or plugin, but JavaScript is the only 'universal' client-side scripting language.
Upvotes: 3