[webkit-help] How to handle file downloading in NPAPI plugin

Jianhua Shao alex.sjh at gmail.com
Thu Dec 29 05:39:10 PST 2011

Here, in a html page, there is a <meta> tag like this:
<meta http-equiv="refresh" content="1; url=http://www.example.com/file.jar" />

I want to download that 'file.jar',  but the webkit browser here (is
very simple) seems to fail to handle .jar file.
And I have no access to webkit source code.

So, I want to write a NPAPI plugin, which handles the downloading.
Actually, I have written a download service,
the job of the plugin is throw a URL (aka.
http://www.example.com/file.jar) to that service. Then it is done. The
should stay at the original page.

I register "application/x-java-archive" and "application/java-archive"
MIMIType in NPAPI, when I get the url in NPP_NewStream,
and then destroy the stream by calling NPN_DestroyStream, I suppose
the webpage could stay at the orignal page, but it shows a blank page.

>From the log, I found NPP_NewStream has been called by browser.

So, I wonder how I can handle file downloading and do not refresh the
web page? Could any one give some hint to me? I am not
so familiar with NPAPI APIs.

FYI: I set the plugin windowless by calling
"sBrowserFuncs->setvalue(instance, NPPVpluginWindowBool,

More information about the webkit-help mailing list