Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

You could do something like:




At least on Chrome for OS X, neither of these work on the new tab page; you must first open any other page first. Loading about:blank does just fine.

share|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
chrome doesn't like spaces: so javascript: x=3; alert(x); is different from javascript:x=3; alert(x). The former doesn't work, the latter does. – user257309 Sep 25 '13 at 13:34

Start Chrome with the --enable-user-scripts command line option.

Then javascript: URLs will work fine!

share|improve this answer
This is not actually necessary, at least on OS X. Entering javascript:window.alert("hello"); works just fine without it. – Daniel Beck Jun 30 '12 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .