With Firefox I can type in the location bar "javascript:" followed by some JavaScript code and have this code executed and the result displayed in the page. For example javascript:x = 3 displays 3 in the page.

However with Chrome nothing is displayed. Is there a way to do this in Chrome?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

You could do something like:

javascript:x=3;alert(x)

Or:

javascript:x=3;document.write(x)
link|improve this answer
Nope, doesn't work for me. Or it doesn't work if I paste the string. Typing it in seems to work. Google's autocomplete seems to be interfering and won't turn off. Makes it feel like IE. – Malvolio Oct 19 '11 at 22:37
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.