I've searched and discovered that I can simulate a keypress event using jQuery, but my knowledge about jQuery is poor and I didn't get how exactly.
So I have a Greasemonkey script which manages 2 different webpages in 2 tabs.
I'd like to simulate/auto-execute CtrlShiftTab to go back to the previous tab automatically, this way I could change tabs in Firefox.
The problem is that it's not only a plain keypress, I need to simulate a Ctrl and Shift parts too.
I've added this to my script:
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
and tried:
function testEvents(){
var press = jQuery.Event("keypress");
press.which = 9;
$("whatever").trigger(press.ctrlKey + press.shiftKey + press.which);
}
without success.
Some links I've seen: Is it possible to simulate key press events programmatically?, simulate jquery, and http://forum.jquery.com/topic/simulating-keypress-events