I created a chrome extension for changing default font of some websites.
manifest.json
{
"name": "Custom Font",
"version": "0.0.1",
"description": "A Extension to change default Fonts.",
"manifest_version": 3,
"content_scripts": [
{
"matches": ["https://dev.to/*", "https://github.com/*"],
"js": ["main.js"] // content.js
}
]
}
main.js
const head = document.head || document.getElementsByTagName('head')[0];
const link = document.createElement('link');
link.rel = 'stylesheet';
if (window.location.href.includes('https://dev.to')) {
link.href = chrome.runtime.getURL('devTo.css');
}
if (window.location.href.includes('https://github.com')) {
link.href = chrome.runtime.getURL('github.css');
}
head.appendChild(link);
but when I try to run above code in mentioned websites it is giving me an error :
GET chrome-extension://invalid/ net::ERR_FAILED