This is the same question as THIS IS ONE , I can no longer answer this question, so I am rewriting it using my account. Sorry for the mess.
I need a Greasemonkey script that activates a href link on a page load, such as "javascript: FUNCTION". I saw this code:
<script language="Javascript" type="text/javascript"> function somescript() { window.location.href = document.getElementById('ololo').href; } </script> <a href="javascript:alert('test');" id="ololo">test</a> <br /> <a href="javascript:somescript()">click me</a>
and although it works on a local page even when using onload, it does not work when I use it in a script.
I probably miss something while passing code from the body of an html page to a Greasemonkey script.
Hope this time the question is clearer, excuse me for any misunderstanding, but I'm still new to JS.
javascript href greasemonkey hyperlink
Gurzo
source share