I'm just fiddling around with user scripts in chrome right now, so please bear with my potential ignorance/idiocy.
In the page I'm writing a script for, there is a <script>
element that declares a variable x
.
Does this mean that, in my user script, I can just access x
from the global namespace?
For example, if the only line in my userscript is alert(x);
, should that work as expected (assuming x
is a String)? I understand chrome doesn't support unsafewindow, but for some reason I'm finding it impossible to figure out how to mimic the functionality. Is it even possible?
contentWindow
was available in Chrome 3, but removed in Chrome 4. Only possible solution for Chrome 4:
location.href="javascript:(function(){ alert('Hello'); })()"