3

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?

Community
  • 1
  • 1
Akbar
  • 1,509
  • 1
  • 16
  • 32

2 Answers2

2

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.

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • Hi Taxilian,I have tried calling NPAPI Plugin from injected script of Safari extension,extension was loaded NPAPI successfully but it was failed loading from global.html,Thanks – Akbar Aug 09 '11 at 10:44
  • of course it supports safari 5.1; if you have issues get the latest from source control. This isn't a good place to ask questions like that, however -- ask on the forums, the chat room, or the google group, rather than having discussions in the comments on SO – taxilian Aug 09 '11 at 18:56
1

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

belykh
  • 1,109
  • 10
  • 25