I am pretty new to chrome extension development.
The issue is not with accessing the chrome:// url I do not want to edit anything there, but the issue is regarding the execution of the chrome.tabs.executeScript() which is used for injection of the scripts.
I am trying to run a background script using the chrome .tabs.executeScript but it gives the following errors :
Unchecked runtime.lastError while running tabs.executeScript: Cannot access a chrome:// URL
I have the following code :
Manifest
{
"name": "BrowserExtension",
"version": "0.0.1",
"manifest_version": 2,
"description" : "Description ...",
"icons": { "16": "icons/16x16.png", "48": "icons/48x48.png", "128": "icons/128x128.png" },
"background" : {
"scripts": ["background.js"]
},
"permissions": [
"tabs",
"background",
"http://*/*",
"https://*/*"
],
"browser_action": {
"default_icon": {
"19": "icons/19x19.png",
"38": "icons/38x38.png"
},
"default_title": "That's the tool tip"
}
}
Background.js
console.log("background.js : click()");
chrome.tabs.executeScript(null, {file: "jquery.min.js"}, function(){
chrome.tabs.executeScript(null, {file: "auto.js"}, function(){
chrome.tabs.executeScript(null, {file: "script.js"}, function(){
//all injected
});
});
});
script.js
$(function()
{
var input = $('input');
$.each(input,function(index,element){
var area = new AutoSuggestControl(element.id);
});
var ta = $('textarea');
$.each(ta,function(index,element){ var area = new AutoSuggestControl(element.id);});
return 1;
});
auto.js is a precompiled js file which works perfectly fine when used alone in a html file. The aim of the extension is to provide autocomplete while writing in a textfield. Thanks a ton for helping.