Hijacking a variable with a userscript for Chrome
问题 I'm trying to change the variable in a page using a userscript. I know that in the source code there is a variable var smilies = false; In theory I should be able to change it like that: unsafeWindow.smilies = true; But it doesn't work. When I'm trying to alert or log the variable to the console without hijacking I get that it's undefined. alert(unsafeWindow.smilies); // undefined !!! EDIT: I'm using Chrome if it changes anything... http://code.google.com/chrome/extensions/content_scripts