I am trying to run JavaScript functions on someone else's website using a button in my Chrome Extension.
In my HTML file, I have a button:
<input id="form-save" type="submit" value="Start" />
I would like to run a function that will first check if the website I'm on is a certain website, and will then run a function on that website such as:
function reload_page() {
location.reload();
}
I have got code to run inside of my extension using:
// Pure JS:
document.addEventListener('DOMContentLoaded', function() {
document.getElementById("click-this").addEventListener("click", handler);
});
// The handler also must go in a .js file
function handler() {
/* ... */
}
which I got from onClick within Chrome Extension not working.
Although, I cannot get any code to run on the website I'm actually on in Chrome.
Any help would be greatly appreciated, thanks.