Why do you need to use eval() in the first place? Usually, that's a sign
of a design flaw somewhere. Are you trying to grab a JSON value or
something? If so, there's a much safer parser available, for example, at
http://www.json.org/js.html.
If you absolutely must execute GM functions from the page's code, you'll
need to set up some means of having the code inside the page (in your
case, apparently, the eval()ed code) signal your GM script with the
parameters to pass to the appropriate GM functions, and vice versa; in a
similar situation, I am using a strategy of creating an invisible div or
similar with the correct data and a reasonably unique ID (probably best
to use a GUID or similar, generated on the spot), and registering an
event handler within the GM script, listening for the addition of a node
with that ID.
There may be other, faster or easier, ways to communicate between pages
and GM scripts, but that's what I'm using.
In short: it is massively insecure and probably almost impossible to
execute a GM function directly from within an unsafeWindow. GM is
deliberately designed to make that very hard. Don't try to defeat that
protection, just design your script to work around the need for it.
Jan Buschtöns wrote:
> Hello,
> I've got a littel Problem: I'ver got a String. As example "var data =
> GM_getValue('data'); alert(data);". I just wanted to execute zhis
> String by eval(), but theAccess Violation error, that unsafeWindow can
> not execute GM_functions. What can I do, to execute Strings with
> GM_functions. My Time is limited, please answer fast,
>
> Thanks!
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---