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

流过昼夜 提交于 2019-12-10 21:52:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!