The first version (downloading the file each time) is explained here [1].
As for the second approach add a @require line to the script's header

@require jQuery http://<url of the jquery file>

In the script's body, use the same code as before ([1]) but replacing
  GM_JQ.src = 'http:...'
with
  GM_JQ.textContent = GM_getResourceText('jQuery');  // or maybe GM_JQ.innerHTML

I'm not sure whether GM_wait() is necessary at all in this case, but
it doesn't hurt anyway.
I don't know whether Chrome supports the @require header, so maybe in
this case you'll have to resort to the first approach.
You'll find an example under [2].

Tip: whenever you look for examples of use of some
object/technique/etc in userscripts, make a Google search like:

site:userscripts.org inurl:scripts/review  <search term>

For me it has proven to be very useful.

[1] http://joanpiedra.com/jquery/greasemonkey/
[2] http://userscripts.org/scripts/review/50771


On Fri, Jan 29, 2010 at 5:52 AM, Kia <[email protected]> wrote:
>
> Thanks. Could you please provide an example? I also need my userscript
> to work in chrome, if possible.
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to