views:

391

answers:

3

My friend wants me to turn his Cocoa application into a firefox plugin. The application takes the URL of the site where the data is to be downloaded from, and downloads it, taking the load off of the browser. My question is, since firefox plugins are written in javascript (I think), and the application is written in objective C, is this even possible? Also, is there any advantage to downloading a file from someplace else, as to not interfere with other web-browsing? Will the browsing still be slow because the internet connection is being used? Is there any possible advantage this could have?

Thanks guys! :)

+1  A: 

I suggest you check out the SQLite Manager and FireFTP plug-ins. They do some pretty amazing stuff (especially FireFTP) that you could use, or at least convince you that it is actually possible.

Also, I think firefox already does a great job with download queue's. If you have a limited internet connection (in terms of speed, and connections) you will eventually end up having a slower browser (or download).

But maybe the plug-in can prioritize downloads? Give browsing itself the priority, by making sure there is always enough bandwidth left??

Good luck.

MiRAGe
+3  A: 

Actually Firefox plugins (such as Flash, Java and video codec support) are mostly written in C and/or C++, not Javascript.

You should not confuse the plugins with the Firefox add-ons (it's the latter that are written in Javascript).

You can use Objective-C to code a Firefox plugin, as long as your plugin is binary compatible with the Firefox Plugin API interface.

Here are some instructions about how to setup this.

Also, is there any advantage to downloading a file from someplace else, as to not interfere with other web-browsing?

Yes, there is. A separate download manager program can do additional clever stuff with downloading that Firefox does not do (like automatically opening multiple download connections, having a searchable download history, automatically adding downloaded files to specific folders based on file types, etc). Take a look at Speed Download for an example of some of the options.

(You could also implement most of this stuff with a Firefox add-on (such as this), but native code is always more integrated and flexible).

Will the browsing still be slow because the internet connection is being used?

The total bandwidth of the connection is shared by all running applications, so having another app download stuff wont help you in this area. However, this arrangement will offload the browser of having to deal with the open download connections, so the browser could theoretically be a little snappier.

foljs
"Theoretically" a little snappier is right. In practice, handling a download wasn't even that challenging for Netscape Navigator on 1998-era hardware.
Chuck
Yeah, while what you write is correct --the difference should be negligible--, in practice I've seen browsers and programs doing internet IO (like Finder.app looking for a network share), halting or getting slower when connected on an unreliable source, when they get timeouts, etc. Probably due to bad coding, more than anything, but it does happen.
foljs
+1  A: 

I don't really see any advantage to your friend's app either. It would be pretty easy to communicate with the app from a Firefox add-on by having the app implement a custom URL scheme, if that's what you want.

Chuck