Reputation: 2872
I am trying to insert a plugin I created into a page using a content script in a Google Chrome extension. According to the documentation: "If your plugin is "public", you can even use a content script to programmatically insert your plugin into a web page." http://code.google.com/chrome/extensions/npapi.html
Unfortunately the examples they give do not inject a plugin programmatically. In the 'background.html' file I embed the plugin using:
and then I can get the plugin by simply calling: document.getElementById('myPlugin')
How do I do this in a javascript content script?
Upvotes: 1
Views: 2009
Reputation: 2121
They mean you need to use the content script to insert the embed
tag and information: (psuedo code)
function addIt(){
myEmbed = document.createElement('embed');
myEmbed.attributes(add your attributes so easy with jquery);
document.getElementByTagName('head')[0].append('myEmbed');
}
Upvotes: 1