Search code examples
javascriptgoogle-chrome-extensioncontent-script

Content Script not working for some reason


I am trying to use a content script on my website but for some reason it isnt working

Here is my manifest.json:

    "manifest_version": 2,

    "name": "TabToCal",
    "description": "Extension used to save a tab in calendar, for a later consultation.",
    "version": "1.1",
    "permissions": [
        "tabs"
    ],
    "content_scripts": [{
        "matches": ["*://*.tabtocallapi.herokuapp.com/*"],
        "js": ["contentscript.js"]
    }],

    "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "login.html"
    }

Here is my contentscript.js:

console.log("test");

var greeting = "hello, ";
var button = document.getElementById("mybutton");
button.person_name = "Oscar";
button.addEventListener("click", function() {
    alert(greeting + button.person_name + ".");
}, false);

None of these are running any reason why?

It also is not appearing in the content script section


Solution

  • never mind had to remove and re-add the extension in my extensions for some reason it wasn't auto-updating.