Injecting JS functions into the page from a Greasemonkey script on Chrome
问题 I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so far: First, I get a helper reference to the unsafeWindow for Firefox. This allows me to have the same code for FF and Opera (and Chrome, I thought). var uw = (this.unsafeWindow) ? this.unsafeWindow : window; Next, I inject a function into the page. It