Your programming language in a browser (i.e. Javascript)?
Is it possible to write a plugin that would allow client-side scripting to be done on the browser in a non-Javascript language (take your pick - TCL, Rebol, Perl, Ruby, Python, Lisp, etc)?
To clarify, I am NOT talking about browser plugins which allow "applets" for particular languages to run in the browser - I know that's been done. I'm asking whether one can use another language besides Javascrip开发者_如何学运维t (or whatever else has been done) for the HTML scripting through use of a plugin or other means? I'm talking about [insert your language] between the <script>...</script>
tags.
My guess is this hasn't been done. If so, is it because it's just plain difficult/impossible?
Thanks.
For your own browser, doable. For anything you want to place on a public website, it would need wide-spread adoption first, so: no, impossible. You have to stick with JavaScript.
You could compile your language down to JavaScript if that works for your scenario, just like Google's Web Toolkit does. Or write an interpreter for it in JavaScript.
There are many compilers and interpreters that translate other languages into JavaScript.
For example, it is possible to run .NET languages in the browser using JSIL, or JVM languages in the browser using DoppioJVM.
精彩评论