Register scripting language with browser?
Do any browser vendors support the use of any scripting languages besides
text/javascript
text/vbscript
(IE only)
for example:
text/lua
text/cs-script
text/php
text/tcl
If i wanted to use another scripting language in a browser:
<SCRIPT type="text/javascript">
...some JavaScript...
</SCRIPT>
<SCRI开发者_高级运维PT type="text/vbscript">
...some vbscript...
</SCRIPT>
<SCRIPT type="text/perl">
...some Perl Script...
</SCRIPT>
<SCRIPT type="text/php">
...some Php...
</SCRIPT>
<SCRIPT type="text/tcl">
...some Tcl...
</SCRIPT>
<SCRIPT type="text/lua">
...some Lua...
</SCRIPT>
<SCRIPT type="text/pascalscript">
...some PascalScript...
</SCRIPT>
<SCRIPT type="text/cs">
...some C#...
</SCRIPT>
could i?
Is there a way to register 3rd party scripting engines with any browser?
Technically, Internet Explorer can use any script language which provides an IActiveScript
implementation, and I've seen implementations of both PERL (from ActiveState) and TCL running clientside in IE.
But to minitech's point, this isn't something that would work across browsers, and frankly it's a terrible idea in almost all circumstances.
No. If you want to use a different language, your best bet is using something that compiles into JavaScript (eg Pyjamas for Python).
Google Chrome has a native code plugin, allowing the use of any language for which you have the correct plugin. For example, there is a Tcl implementation for it.
There is now brython
to run python 3
programs:
see www.brython.info
Impressive work!
seem work across many browsers (I don't have IE)
... still waiting for a perl
port...
There are what I consider hack-ish ways to do it which involves some kind of interpreter between the browser and the script language. Two examples of this are using SilverLight to interface with various dynamic languages, or JRuby to interface using Ruby script. Otherwise it has to get compiled to JS.
No, there isn't. Not any portable way, at least, and not anything you should do.
精彩评论