Any tips for writing cross-browser Greasemonkey userscripts?
I have a few scripts that clean-up some of the sites I use. But, I have now switched over to Chrome fro开发者_运维技巧m Firefox and some of the scripts don't work, even though I can install them.
Can anyone offer any tips on how to write Userscripts that work (nearly) cross-browser? Specifically, Firefox and Chrome, and maybe Opera.
I've been working on a User Script engine comparison table which should help you know which GM_APIs you can depend on.
Other then that you need to write cross browser JavaScript which is a long topic; I would recommend the DOM compatibility tables offered by QuirksMode for cross browser DOM usage.
The easiest way is just to install Tampermonkey. It will allow you to run most GM scripts, as-is, on Chrome.
Firefox: as usual
Chrome: http://www.techrena.net/internet/enable-greasemonkey-user-scripts-google-chrome-easily/
Opera: http://www.opera.com/docs/userjs/examples/#greasemonkey
精彩评论