[Greasemonkey] Inspecting / Modifying global in-page variables in 0.6

Anthony Lieuallen arantius at gmail.com
Wed Sep 14 14:21:34 EDT 2005


So, a script I wrote (Gmail Action Links) uses the technique in the
test case below to find a variable with particular value and modify
that variable.

HTML:
<html>
<head>
<script type='text/javascript'>
var myval='My Value';
</script>
</head>
<body >
<button onclick='alert(myval);'>Button</button>
</body>
</html>

User script:
for (key in unsafeWindow) {
	val=unsafeWindow[key];
	if ('My Value'==val) {
		unsafeWindow[key]='Our Value';
	}
}

When that user script runs on that page (In GM 0.5.3 in FF 1.0.6),
pressing the button alerts the "modified" value.  In 0.6.2 on 1.5
though, the key is never found so the modification is never made.  I
can't remember anything that leads me to find the solution to this. 
Is there one?


More information about the Greasemonkey mailing list