开发者

How can I load a NPAPI Plugin from a Safari extension?

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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜