How can I load a NPAPI Plugin from a Safari extens

2019-07-04 06:48发布

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?

2条回答
乱世女痞
2楼-- · 2019-07-04 07:29

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

查看更多
在下西门庆
3楼-- · 2019-07-04 07:39

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.

查看更多
登录 后发表回答