问题
I have a npapi plugin composed of a dll and manifest.json file. This npapi dll is detected as plugin on chrome ie it is listed on about:plugins page. However, when I invoke this plugin in sample html page using tag, it says 'Plugin failed to load'. Any ideas why this plugin fails to load in chrome.
Thanks
回答1:
With the information you have provided it is impossible to say for sure, but I would guess it is one of two things:
Your plugin may have an external dependency that isn't being found. If you are linking to another library that requires a .DLL file (or if you're using /MD for the DLL version of the CRT) and the DLL can't be found when the browser tries to load the plugin DLL then your plugin will silently fail to load
Your plugin DLL may be loading but then throwing an exception, incorrectly handling things, etc in such a way that the browser decides that it isn't a valid plugin. Most likely this isn't the case, since Chrome usually reports something like that as a crash, not a missing plugin. You can verify this, though, by starting Chrome with the command line argument --plugin-startup-dialog, which will cause a dialog with the pid to pop up before the plugin DLL is loaded. You can then attach a debugger and tell it to continue.
OF those two, the first is by far the most common issue I see. You can troubleshoot it by getting Dependency Walker (depends.exe) and opening the DLL in-place to see what is missing. If you see ieshims.dll ignore it -- it always thinks that's missing, but finds it when the browser is running.
More tips on debugging plugins can be found at http://npapi.com/x/MYAG and of course if you're not already I'd recommend using the FireBreath framework which solves most NPAPI problems you may run into for you.
Good luck!
回答2:
You have to define MIME type in the plugin .rc file. Failing to do this prevent the plugin to load properly :
VALUE "MIMEType", "application/myapp"
来源:https://stackoverflow.com/questions/6785781/npapi-plugin-not-loaded-on-chrome