you could also do a var myfunc = new Function(details.responseText);
and then call myfunc();
but the same as in eval's case, it is really dangerous to do that.

On Tue, Mar 16, 2010 at 2:15 AM, Fracture <[email protected]> wrote:
> One option is using @require, but Greasemonkey will only download the
> script when it's first installed. [1]
>
> Another option is
>
> GM_xmlhttpRequest({
> ...
> onload: function(details) {
>
> eval(details.responseText);
>
> });
>
> But this is dangerous and should be avoided whenever possible.
>
>
> [1] http://wiki.greasespot.net/Metadata_Block#.40require
>
> On Mar 15, 8:59 pm, dashman <[email protected]> wrote:
>> i've got a greasemonkey script and it works.
>>
>> i'd like to take a function within this existing script and download
>> it
>> dynamically from my site using xmlhttprequest and then
>> execute it.
>>
>> the result is the same - the difference is that the function
>> executes the downloaded code.
>>
>> any help appreciated.
>
> --
> 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.
>
>



-- 
jgabios
http://bash.editia.info

-- 
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