Re: downloading a file via HTTP w/ XPCOM and JS
Mike Lee <[email protected]> Wed, 30 Oct 2002 15:08:31 +1100
| Newsgroups | gmane.comp.mozilla.devel.xpcom |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
You probabily didn't use nsIURL to wrapp the url. In mozblog there is a
example of how to use it. Check [1] function preFetchWebsite() and
httpListener.
Regards
[1]
http://www.mozdev.org/source/browse/mozblog/content/discuss/editorExtension.js?rev=1.3&content-type=text/x-cvsweb-markup
Adam Fletcher wrote:
> Hi everyone,
>
> I'm looking for an example of how to download a file using Javascript,
> XPCOM and HTTP. I'd like to do this entirely with XPCOM.
>
> My best start, which doesn't work:
>
> var ioService = getService('@mozilla.org/network/io-service;1',
> 'nsIIOService');
> var chann = ioService.newChannelFromURI(someURL).QueryInterface(
> Components.interfaces.nsIHttpChannel);
>
> // someFileListerner has onStopRequest, onStartRequest, etc..
> chann.asyncOpen(someFileListener, null);
>
>
> Any help would be appreciated.
>
> Thanks,
>
> Adam Fletcher
>
--
Mike Lee
Website: http://www.exitspace.net/mike