开发者

Native Java / Python / Objective C in Firefox?

开发者 https://www.devze.com 2023-04-12 10:50 出处:网络
Is it possible to integrate Java, Python, or Objective C directly with the Firefox browser?In particular to do \"real\", native tasks such aswriting files or connecting to a local database, or better

Is it possible to integrate Java, Python, or Objective C directly with the Firefox browser? In particular to do "real", native tasks such as writing files or connecting to a local database, or better yet, directly calling systems level code ?

Notably, there is a post on native code execution, somewhat slanted towards windows, elsew开发者_如何学编程here on StackOverflow: Firefox extension: native code execution?


In particular to do "real", native tasks such as writing files or connecting to a local database, or better yet, directly calling systems level code ?

You don't need an extra language for that, Firefox extensions can do it already:

  • Writing files
  • Connecting to a local SQLite database
  • Calling system libraries directly

I would recommend against attempting to write the extension in anything other than JavaScript: while there are several possibilities they create a lot more trouble than they are worth. If anything, you could create a native library and call it from your JavaScript code via js-ctypes (see link above).


A "signed" Java applet, given the correct permissions and approved by the user, can run in the browser context and have access to files or databases. However, Java applets in the browser are almost never used today (I've had Java disabled in my browser for years).

Microsoft browsers offer ActiveX, which is a way of running native code in the browser, but I don't know whether anybody uses that today either.

Google's nativeclient is another method of running native code, but only works with Google browsers at this time. Not sure whether that allows direct access to files at all.


PythonExt brings Python support to Firefox: http://code.google.com/p/pythonext/

I'm not sure how quickly they update it for Firefox's rapid releases, and you do need to install an extension, and then it will only work in a trusted context (i.e. an extension you right yourself)


Alternatively you could build Windows 8 Metro style apps that let you use web technologies and native code together:

http://channel9.msdn.com/posts/Raman-Sharma-Building-Metro-Style-Apps-with-C-and-JavaScript http://code.msdn.microsoft.com/Hybrid-JavaScript-and-C-e6dc77fa

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号