Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

jQuery can be added to programmatically injected content scripts in Google Chrome extensions by following these steps:

  1. Download the jQuery library from the jQuery website.
  2. In your extension's manifest file, specify the path to the jQuery library in the "webaccessibleresources" key:
"web_accessible_resources": [
  "jquery.js"
]
  1. In your content script, create a new script element and set its "src" attribute to the path to the jQuery library:
var jqueryScript = document.createElement('script');
jqueryScript.src = chrome.extension.getURL('jquery.js');
document.head.appendChild(jqueryScript);
  1. Use jQuery in the content script as you would normally:
$(document).ready(function() {
  // Do something with jQuery
});