<p>I had an idea for a client-side language other than JavaScript, and I'd like to look into developing a Firefox plugin that would treat includes of this new language in a page, like &lt;script type="newscript" src="path/script.ns" />, just as if it were a natively supported language. The plugin would do all of the language parsing and ideally be able to perform every operation on the browser and the html and css within the web page just as JavaScript can.</p>

<p>I've done a bunch of Googling and have found some articles on writing basic Firefox plugins, but nothing as complicated as this.</p>

<p>Is this even possible?</p>

[{'answer_id': 70104, 'author': 'rpetrich', 'author_id': 4007, 'author_profile': 'https://Stackoverflow.com/users/4007', 'pm_score': 0, 'selected': False, 'text': '<p>Do you really want to tie your pages to your own custom scripting language? Or are you just looking to write your client-side code in something that\'s not javascript? If the latter try <a href="http://milescript.org/" rel="nofollow noreferrer">MileScript</a>, <a href="http://haxe.org/" rel="nofollow noreferrer">Haxe</a>, or <a href="http://code.google.com/webtoolkit/" rel="nofollow noreferrer">Google Web Toolkit</a></p>\n'}, {'answer_id': 70239, 'author': 'Nathan de Vries', 'author_id': 11109, 'author_profile': 'https://Stackoverflow.com/users/11109', 'pm_score': 2, 'selected': False, 'text': '<p>If I\'ve understood what you\'d like to do, you\'ll need to write a Gecko plugin. Via a plugin, you will be able to register your own MIME type and then manipulate Javascript &amp; the DOM.</p>\n\n<p>This means you would need to include an <code>&lt;object /&gt;</code> or <code>&lt;embed /&gt;</code> tag on the page to load your plugin, but you could then look for <code>&lt;script type="application/x-yourtype" /&gt;</code>, grab the innerText of that script tag and parse it using your plugin.</p>\n\n<p>As Nickolay has suggested, the alternative is to use whatever the browser currently supports or create a custom build of the browser. Daniel Spiewak\'s suggestion to use a Java applet (or a Flash applet would also work) is also valid.</p>\n\n<p>The information you\'re after is available on Mozilla\'s developer website:</p>\n\n<ul>\n<li><a href="http://developer.mozilla.org/En/Gecko_Plugin_API_Reference" rel="nofollow noreferrer">Gecko Plugin API Reference</a></li>\n<li><a href="http://developer.mozilla.org/En/Gecko_Plugin_API_Reference:Plug-in_Basics" rel="nofollow noreferrer">Plug-in Basics</a></li>\n</ul>\n'}, {'answer_id': 70289, 'author': 'Daniel Spiewak', 'author_id': 9815, 'author_profile': 'https://Stackoverflow.com/users/9815', 'pm_score': 2, 'selected': False, 'text': '<p>An interesting idea.  Note that you don\'t actually need to write a browser-specific plugin to do this.  Some <a href="http://almaer.com/blog/running-ruby-in-the-browser-via-script-typetextruby" rel="nofollow noreferrer">people have experimented</a> with using JRuby in an Applet to execute code embedded within <code>&lt;script type="text/ruby"&gt;</code>.  Such a solution may be slower on startup (due to the overhead of loading an entire JVM instance), but it will be much more flexible in the long run (cross-browser).  Besides, it\'s a bit easier to build a custom language interpreter in a JVM language than it is to try to shoe-horn it into Gecko.</p>\n'}, {'answer_id': 70698, 'author': 'Nickolay', 'author_id': 1026, 'author_profile': 'https://Stackoverflow.com/users/1026', 'pm_score': 3, 'selected': True, 'text': '<p><a href="https://stackoverflow.com/questions/69982/writing-a-firefox-plugin-for-parsing-a-custom-client-side-language#70239">@Nathan de Vries</a>: no, actually, NPAPI plugins you suggested don\'t let one implement support for <code>&lt;script type=...&gt;</code>.</p>\n\n<p>OP: this is not easy, but look for PyDOM and PyXPCOM - language bindings for Python. The former does exactly what you asked for - for Python, but I\'m unsure about its current status. In any case, it\'s very likely that you need to create your own build of Firefox to support additional script types.</p>\n'}]
['https://Stackoverflow.com/questions/69982', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1943957/']