


Replace 'google' with whatever domain you're working with. Second is a javascript function to see if substring is in string. In one of them had some code that I modified.įirst line gets the url. Yes, most certainly! It's always worth looking at the available scripts (link above) and see if they have code you can use. This enables your bookmarklet to be cross browser compatible, and each browser has a way to activate bookmarklets with hotkeys and/or gestures.Īs for control Tab, there's some scripts that access the firefox api directly. You can set a hotkey to any bookmarklet (google it) and have your gesture activate the the hotkey (the send key script above). There's some handy bookmarklet tools and creators out there. I don't know FF api terribly well, but bookmarklets use straight up javascript, which is quite handy for a ton of features/functions. I tried using the number and/or formula, but having the 2 hex codes in the above script made it work. (evt2) Ġx4E is equivalent to the value of 'n'.charCodeAt(0) or 110 (see the Mozilla page for the codes). Var evt2 = ("KeyEvents") Įvt2.initKeyEvent("keypress",true,true,null,false,false,true,false,0x4F,0x4F) So I managed to send the keys 'Shift-n Shift-o' (open next subscription) to Google Reader with the following script:Ĭode: Select all var evt = ("KeyEvents") Įvt.initKeyEvent("keypress",true,true,null,false,false,true,false,0x4E,0x4E) Therefore you have to change 'document' to '' (saw it in the Copy Title script). So keys for Firefox (such as Ctrl-S for save) works but not for a website's keyboard shortcuts.

It seems firegestures' script works on the chrome xul rather than the document itself (you can see it with alert(location.href) ). "`".charCodeAt(0) // presses a normal key, e.g. I created this code to switch to the next tab group (in Firefox 4) "y".charCodeAt(0) // presses a normal key, e.g. I decided to sign up to this forum just to share this for future requests (it came up high when I looked for it on Google):Ĭode: Select all var evt = document.createEvent("KeyEvents")
