johnnash
johnnash

Reputation: 424

How to load scripts on url override on new tab in chrome extension?

My manifest.json looks like this.

    {
      "manifest_version": 2,

      "name": "Getting started example",
      "description": "This extension shows a Google Image search result for the current page",
      "version": "1.0",

      "chrome_url_overrides" : {
        "newtab": "a.html"
      }
    }

I want to include myScript.js and jquery.js on a.html.

I have tried using script tags on a.html( which do not work as inline script not allowed).

Dabbled with content script and background page.But I don't think I need content script here since I am not looking for interaction with current page content.I think this can be accomplished by background page but it does not seem to be working.I have tried adding "background": { "scripts": ["jquery.js", "myScript.js"] } to manifest.json but it does not seem to work.

How do I add myScript.js and jquery.js to a.html.

P.S.: All files are in same directory.

Upvotes: 2

Views: 596

Answers (1)

Maverick
Maverick

Reputation: 41

Try adding external JS as:

<script src="myScript.js"></script>

to a.html page and creating myScript.js and writing your JS Code in it.

Upvotes: 1

Related Questions