问题
My query is similar to this global.html is unable to load NPAPI plugin from safari-extension builder but its loading from the direct link.
How can I load a NPAPI Plugin from a Safari extension?
回答1:
The simple answer is that you can't. Unlike firefox and chrome extensions, Safari extensions don't allow you to embed npapi plugins in them.
回答2:
You can create toolbar in Safari extension
Load npapi to the toolbar
On start extension make it invisible
Get toolbar object
Get plugin object from toolbar object
try {
var toolbarWindow = safari.extension.bars[0].contentWindow;
safari.extension.bars[0].hide();
var doc = toolbarWindow.document;
var plugin = doc.getElementById("plugin");
if (plugin)
plugin.samefunction();
} catch(e) {
}
tested on Safari 5.1, 6.0
来源:https://stackoverflow.com/questions/6909307/how-can-i-load-a-npapi-plugin-from-a-safari-extension