using 'location hack' to read a variable

25 views
Skip to first unread message

Jon Gomez

unread,
Sep 12, 2012, 5:47:33 PM9/12/12
to greasemon...@googlegroups.com
Hi guys, I was trying to read a variable using the 'location hack', with the following code:

location.href = 'javascript:var read = (window.content_global)';

but this seems to crash greasemonkey when I try to access the variable 'read', for example when I try to do: alert("What I read was: " + read); ... is there another way to do this? I was trying to avoid using 'content global reader', but if you guys think I should use it, I will.

Anthony Lieuallen

unread,
Sep 12, 2012, 5:51:40 PM9/12/12
to greasemon...@googlegroups.com
@grant none

The grant metadata, and specifically the none case, was specifically designed for the case were you want to interact more closely with the page than the legacy security sandbox (gracefully) allows.  If you can't @grant none then http://wiki.greasespot.net/Reading_Content_Globals is your only choice (at least AFAIK).

Jon Gomez

unread,
Sep 12, 2012, 6:01:42 PM9/12/12
to greasemon...@googlegroups.com
YES!! You're the best. I read the location hack article http://wiki.greasespot.net/Location_hack and they say it's so easy to access content variables... I never would've thought of that. Thank you.
Reply all
Reply to author
Forward
0 new messages