I'm not trying to parse a JSON Code ;)
I'm writing a Script that loads new Contents from a special Index
page. And this Contents must be executed. The only problem is, that
this Contents have GM_function in there.
I did not really understood your way. Shall I put the String into a
<div style="display: none;"> and when get the innerHTML of that div
and execute it via eval()?
I just need to execute a String with GM_functions in it :( . Is there
no way?

On 19 Jul., 23:07, cc <[email protected]> wrote:
> 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, 
> athttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to