• Register
0 votes

Problem :

I am very new to chrome extension development.

The issue which I am facing is not related to accessing the chrome:// url but I do not want to edit anything there, now the issue is regarding the execution of the chrome.tabs.executeScript() which I am using for injection of the scripts.

While trying to run a background script using the chrome.tabs.executeScript() but it gives me following errors :

Unchecked runtime.lastError while running tabs.executeScript: Cannot access a chrome:// URL

Please find below the code for your reference:



    "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": [






    "browser_action": {

        "default_icon": {

            "19": "icons/19x19.png",

            "38": "icons/38x38.png"


        "default_title": "That's the tool tip"




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







    var input = $('input');


        var area = new AutoSuggestControl(element.id);


    var ta = $('textarea');

    $.each(ta,function(index,element){ var area = new AutoSuggestControl(element.id);});

    return 1;


Please note my auto.js is a precompiled js file which works perfectly fine when used alone in a html file. The main aim of my extension is to provide auto complete while writing in a text field.

6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

Please note the chrome:// urls are blocked for security reasons. Google will not want you to change the appearace or settings without the user knowing it. So when you load your extension, it will immediately executes those files inside the chrome://extensions page. So if you want to execute your script in every tab the user goes to, then you should use the following way:

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
    //code in here will run every time a user goes onto a new tab, so you can insert your scripts into every new tab


It will solve your issue

9 7 4
38,600 points
0 votes


chrome:// urls are blocked for security causes. Google doesn't want you to alter the outlook or alter chrome settings without the user knowing it. At the time you load your extension, it instantly executes those files inside the chrome://extensions page. In case you want to execute your script in every tab the user goes to, you must use:

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
    //code in here will run every time a user goes onto a new tab, so you can insert your scripts into every new tab

Generally (view also Programmatic Injection in docs) it's not possible to impel scripts into tabs with chrome:// urls since the approved schemes are <scheme> := '*' | 'http' | 'https' | 'file' | 'ftp'.

In Chrome before v61 it was still feasible to impulse into the content frame of the New Tab page, where the "blank address bar" you alluded is illustrated inwardly as chrome://newtab/. For instance the main frame has an address like this: https://www.google.com/_/chrome/newtab?espv=2&es_th=1&ie=UTF-8 (employ Network panel in devtools to inspect the urls). Hence your manifest.json would have "permissions": ["tabs", "https://www.google.com/_/chrome/newtab*"],

Substitutely you can enable chrome://flags/#extensions-on-chrome-urls flag, but this is hardly useful as Chrome will show a warning each begin.

You can also impulse code into pages packaged with your own extension:

browser.tabs.create({url: "/my-page.html"}).then(() => {
    code: `console.log('location:', window.location.href);`

You don't require any special permissions to do this.

You cannot impulse code into any of the browser's built-in pages, such as: about:debuggingabout:addons, or the page that opens at the time you open a new empty tab.

10 6 4
31,120 points

Related questions

0 votes
1 answer 1.5K views
Problem : I am trying to build the Google Chrome extension. I searched on every platform and took every step to resolve my below error &ldquo;Your file was not found it may have been moved or deleted. err_file_not_found&rdquo; I have done everything that I could , but ... \User Data**),like the other extensions my extension also has no folder. Please let me know how to fix the extension issue.
asked Jan 22, 2020 jwilliam 3.9k points
0 votes
2 answers 1.9K views
Problem : Currently I am using VueJS and Laravel for the project. Following issue started to show lately and it also comes up even in the old git branches. Unchecked runtime.lasterror: the message port closed before a response was received. This error only comes up in Chrome browser.
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 239 views
Problem : Facing following chrome error error in event handler for (unknown): typeerror: cannot read property 'indexof' of undefined
asked Nov 16, 2019 peterlaw 6.9k points
1 vote
1 answer 47 views
Problem: I have written a very simple application. Please find below the code for my simple application which is calling the API in each second. After each of the call a chrome memory allocation size for that particular tab increases continuously. But not by the reducing that memory. ... xhttp.send();     } </script> </body> </html> Kindly help me in finding out the root cause of this issue.
asked May 27, 2020 Martin K 6.6k points
0 votes
1 answer 1.6K views
Problem : I had recently uninstalled the Postgres10 and after that reinstalled the Postgres10. After that I went to run a Node, Express, React application that relies on connecting to a Postgres10 database and also communicates with it using Sequelize. Initially I was unable to ... app at in the browser. Does anyone have any idea what is going wrong? Please suggest me the solution for my error.
asked Nov 22, 2019 peterlaw 6.9k points
0 votes
1 answer 10 views
0 votes
1 answer 245 views
Problem: We are currently developing the web application which needs to open in two different browser instances each one on the different Screens. Obviously our pc has the dual display already, and both our monitors have a same size and resolution. As soon as the ... a last position where our last instance was opened so our both instances are opening on a same window regardless of our command.
asked Aug 8, 2020 Raphael Pacheco 4.9k points
2 votes
1 answer 35 views
Problem : I have some issues with chrome browser because of my eyes issues I can&rsquo;t see the bright colors .My browser tab bar has a light tan and white color theme. My eyes are really very sensitive to light bright colors. so I want to customize the color of my ... them because I I am unable to see them. I may go blind from this bright colored browser tab. How can I fix the chrome issue?
asked May 6, 2020 stewart 4k points