I have some code which I'd like to run on mywebsite.com/x.html
(where x
could be anything).
This code below (I'm hoping) will find the button on the webpage with the ID 'mybutton' and automatically click on it after a delay of 1 second:
<script>
window.onload = function() {
setTimeout('document.getElementById('mybutton').click()', 1000);
}
</script>
I Googled and found the Tampermonkey Chrome extension but the only problem is that I have no idea how to run it only on the specific webpage(s) mentioned above.
I kinda just slapped my code onto the end of the example layout given by Tampermonkey and got this:
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match http://website.com
// @grant none
// ==/UserScript==
<script>
window.onload = function() {
setTimeout('document.getElementById('mybutton').click()', 1000);
}
</script>
How can I make it run on the specific webpages mentioned at the beginning?