I am new to JavaScript and currently working on customizing the script from the MDN tutorial, Your First WebExtension
My goal is to draw either a red or blue box around a webpage based on whether it is http:// or https://. But I have encountered a problem where only one script runs.
This is the content of manifest.json:
{
"manifest_version": 2,
"name": "HTTPS Detect",
"version": "1.0",
"description": "Draws a blue border around HTTPS protected websites. Non-HTTPS sites are given a red border, indicating they do not provide encryption.",
"icons ": {
"48": "icons/border-48.png"
},
"content_scripts": [
{
"matches": ["https: // * / *"],
"js": ["httpsdetect.js"],
"matches": ["http: // * / *"],
"js": ["nohttps.js"]
}
]
}
The httpsdetect.js script looks like this:
document.body.style.border = "5px solid blue";
And the nohttps.js script is:
document.body.style.border = "5px solid red";