is it possible to launch an extension from javascript?
for example in my code i check if a specific keyword is in the url with:
let keyword = "xyz"
if (window.location.href.indexOf("keyword") > -1) {
window.location.replace("https://www.google.com/");
}
and if it is in the url, i get redirect to google.com
the problem is that if i try to open my index.html, it opens it as a website instead of an extension popup
so how can you open it as an extension, if you can?
thanks
You need to use chrome.runtime.getURL('path/to/file').
https://developer.chrome.com/docs/extensions/reference/runtime/#method-getURL
Also keep the web_accessible_resources in your manifest.json in mind when using this.
https://developer.chrome.com/docs/extensions/mv3/manifest/web_accessible_resources/