3

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?

7
  • What is your question then? Commented Jan 12, 2013 at 7:18
  • 4
    I wouldn't be surprised if there were browsers that you could install new languages in, but if you're looking for a cross-browser solution, then no, you're stuck with Javascript. Commented Jan 12, 2013 at 7:20
  • 3
    @MrLister you could install a language interpreter through Javascript. Javascript is perfectly capable of parsing Ruby. Commented Jan 12, 2013 at 7:24
  • also see stackoverflow.com/questions/14180092/… Commented Jan 12, 2013 at 7:25
  • 1
    @MrLister I thought coffeescript was compiled server-side to javascript? Commented Jan 12, 2013 at 7:31

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

2

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.

1 Comment

I am amused, surprised, and horrified. Revised appropriately.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.