I do not believe that there is a publicly available, documented method for this.
Take a look at the source code of WebView, in particular in the source file "WebPluginDatabase.mm", to get an idea of ββhow the plugin paths are evaluated and what priority is given to plugins found in different places. By default, it seems that the search path goes in the following order:
- ~ / Library / Internet modules
- / Library / Internet Modules
- Application Plugins Folder
Thus, any plug-in that you include in your application package will be replaced by default with the version located in the userβs folder or the system library.
If using an undocumented SPI is an option, I see that there is a method in WebView.mm that essentially redefines the list of plugin paths, going to the appropriate configuration in WebPluginDatabase single mode:
- (void)_setAdditionalWebPlugInPaths:(NSArray *)newPaths { if (!_private->pluginDatabase) _private->pluginDatabase = [[WebPluginDatabase alloc] init]; [_private->pluginDatabase setPlugInPaths:newPaths]; [_private->pluginDatabase refresh]; }
In the SPI-based solutions section, another stack overflow question has an answer that describes overriding a private WebView method to provide a specific plugin based on the MIME type:
Flash Prevention in Cocoa WebView
This gives me another idea that may be suitable for your purposes. Since you are responsible for the entire viewing, you can consider changing the entire HTML code that is presented in your browser, scanning and changing any content that is usually associated with the Flash plugin, and changing it to call a custom MIME type or something else, to instead load "DitchenFlash";)
source share