Chrome works just fine, and my Greasemonkey script, if copy/pasted into Firefox's Firebug, works just fine on these pages but I can't seem to get it automatically execute.
Download & install the script: http://sente.cc/js/testing_greasemonkey.user.js
and then go to http://imgur.com/gallery/VaA9c (observe simple alert) and http://i.imgur.com/VaA9c.jpg (observe no alert)
the script:
// ==UserScript==
// @name Testing Greasemonkey
// @namespace stuartpowers
// @description Testing Greasemonkey
// @author Stuart Powers
// @homepag开发者_如何学运维e http://sente.cc/
// @include http://i.imgur.com/*
// @include http://imgur.com/*
// ==/UserScript==
// load http://imgur.com/gallery/VaA9c (works)
// load http://i.imgur.com/VaA9c.jpg (doesn't work)
(function () {
alert("worked");
})()
No, Greasemonkey requires an explicit DOM to fire and act upon. It cannot run on Chrome-generated1 pseudo-DOM2.
If you want to act on these kind of "pages", you'll have to write a Firefox extension (add-on). (Note that userscripts in Google-Chrome are converted into mini extensions.)
Here are some add-on resources, I've found helpful:
- Mozilla extensions home page
- Add-on Builder
- 10 Things They Never Tell You In Firefox Extension School
- Developing Firefox Extensions – Paper
1 Here, "Chrome" refers to the privileged DOM that makes up the Firefox's UI.
2 With select exceptions.
精彩评论