I have next question: can I in any way attach my script file to a web site opened in my web browser? This script should be executed only in my machine and should emulate events like onclick
,onmouseover
, etc. I found that I can emulate that events in this way:
var element = document.getElementById('element_id');
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'click', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
But I don't understand how I can implement this code in concrete my situation? Where should I locate this code? How do I attach it the site? How can I generate browser's events for this site? And can I do it?