views:

68

answers:

3

Am I correct that if someone wrote a Ruby plugin for a web browser and a user installed that plugin then it would be possible to replace javascript with ruby on the frontend?

Aren't there any plugins for this? Or even for using other languages than javascript on the browser side?

A: 

Technically that would be correct, assuming the browser/plugin also provided an extensive API to deal with the DOM and such. I am not aware of any plugins that make this possible, but it's an interesting idea.

You
+4  A: 

You could use http://ironruby.net/ in a Silverlight Plugin, but I have not a clue about how easy DOM interaction is this way.

But I BEG YOU don't do it! Please, use the Open Web Stack to solve your problems.
If you don't leave your Ruby world of comfort, you will not only hurt your users experience "WTF? Why do I need Silverlight for this page?" but you will also get stuck in your small little Ruby world without learning anything new and exciting.

It would be better for both of you, if you'd just go ahead and learn JavaScript.

Because remember: "Learning is a good thing!"

Ivo Wetzel
Plugins can introduce immense security leaks and performance problems. Take for instance the flash plugin, which is too processor intensive to run properly on mobile phones and has a patch at regular intervals to close a dangerous security leak. JavaScript IS the language of the browser, if anything, look for a Ruby to JavaScript compiler.
BGerrissen
+1  A: 

There might be a way to do it indirectly. Here is the original presentation at RubyConf 2008. The topic:

This talk is about the many paths towards getting ruby running in your web browser. I'll first talk about why this is even a good idea. I'll then talk briefly about each approach I've investigated and the differing amounts of FAIL I encountered with each. Next I'll focus on the most promising contender, rubyjs, a ruby compiler which outputs javascript.

The project rubyjs still exists, but it appears to be dead. The idea probably was a little too crazy.

molf