I want to write a FireFox extension which simply loads myJavaScript.js
if the user navigates to www.myExampleWebsite.com
. Futhermore this page then detects that the plugin is installed and interacts with it (but this is not part of the question).
I've heard of a possibility by creating an overlay (XUL), which does then define a script-tag with src="myJavaScript.js"
. In this file I check with progress listeners for the current URL.
But this way feels kind of awkward.
My Question is now: How can I write a native (no special magic SDK) FF plugin without the need for defining a XUL file, but loading a JS file directly if the user navigates to a certain page (owned by me).
In chrome extensions such JS files can be defined directly in the manifest file by using the content_scripts
key and the matches
array like:
...
"content_scripts":
[{
"matches": ["https://*.myExampleWebsite.com/*"],
"js": ["myJavaScript.js"],
"run_at": "document_idle"
}]
...
There must be an equivalent in FF for this. I searched and googled for 3 hours without any success.
Thank you in advance.