[webkit-help] How to handle file downloading in NPAPI plugin
alex.sjh at gmail.com
Thu Dec 29 17:49:06 PST 2011
On Thu, Dec 29, 2011 at 11:42 PM, John Yani <vanuan at gmail.com> wrote:
> On 29 December 2011 15:39, Jianhua Shao <alex.sjh at gmail.com> wrote:
>> 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.
> It's not clear what are you trying to do. As I understood, you want a
> user to be prompted to download jar file when visiting a specifically
> designed page, don't you?
Sorry for the confusion. Yes, I want to download the jar file when
visiting that specifically designed
page, but I don't want to prompt user anything, because that page
would show that the file is being downloaded.
I just want that, the downloading begins in background.
>> And I have no access to webkit source code.
> What do you mean? Source code of webkit is here:
Sorry for the confusion again, our OS is a proprietary system, now,
there is a webkit porting and a simple browser, but
no source code is available to me now.
So, getting the open source version of webkit makes no much help for me.
>> So, I want to write a NPAPI plugin, which handles the downloading.
> Why do you need a plugin to download a file?
I could not access the source code of browser and webkit on our
system. And NPAPI plugin is the only option I could think of.
Is there any other option?
>> 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.
> Of course it does. Because you're using <meta http-equiv="refresh"
> content="1; url=http://www.example.com/file.jar" />. This meta tag
> opens url in current window.
That is exactally my problem. Is there any way to let NPAPI plugin
totally take over the specified MIMEType (in my case,
What I want is just let the browser stay at the current page (in
which, there is a 'refresh' mata tag).
>> 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.
> Try opening a file in new window. Why do you need NPAPI for that?
Our system is an embedded system, there is only one full screen page
could be shown.
And the html pages is designed by third party. Current no access or
modification is available.
>> FYI: I set the plugin windowless by calling
>> "sBrowserFuncs->setvalue(instance, NPPVpluginWindowBool,
>> webkit-help mailing list
>> webkit-help at lists.webkit.org
More information about the webkit-help