braican
braican

Reputation: 2202

Chrome blocking javascript on localhost

I'm working on developing a site on my local machine (Windows 7 Ultimate x64) using WAMP, running APACHE v2.2.22, PHP 5.3.13, and MySQL v5.5.24. I'm developing using Chrome v 22.0.1229.94. I've got quite a bit of javascript in the site, however, and Chrome is relentlessly blocking javascript from running on the page.

Clicking on the little 'blocked javascript on this page' icon in the address bar includes the dropdown that has "Always allow Javascript on Localhost" checked off, and I also have a JavaScript exception in Chrome's settings explicitly saying to always allow JavaScript on 'http://localhost'.

Cookies are being allowed, "Allow all sites to run JavaScript" is checked off, and I have no idea as to why Chrome is not allowing the JavaScript to run.

Overall, it's not imperative to the project that I figure out a fix as both IE9 and Firefox 16.1 are allowing JavaScript and I can utilize them. I am simply curious if there's anything I can do to fix this in Chrome, as I would like to continue developing in Chrome.

Upvotes: 48

Views: 31904

Answers (3)

Marques
Marques

Reputation: 1914

If you notice that JavaScript is only blocked when the console is open (as some are saying), chances are that you disabled JavaScript in the console settings.

  1. Open the console.
  2. Click the vertical ellipsis icon (or the gear icon on older versions) in the upper right and go to settings.
  3. See if the "Disable JavaScript" checkbox is checked.

Upvotes: 131

Josh Wulf
Josh Wulf

Reputation: 4877

I have the same issue, but only when the console is open. When the console is closed, JavaScript loads fine on localhost. Makes it hard to debug things though....

I got around it by opening localhost in an incognito window.

Upvotes: 2

Du D.
Du D.

Reputation: 5300

You can give your local server a domain name, may be that would help.

  1. Open C:\Windows\System32\drivers\etc\hosts in notepad
  2. Edit that file add a new line at the end 127.0.0.1 mydomain.com
  3. Save, now goto chrome and type in http://mydomain.com/ this should point to your local server.

Since you nolonger run on "localhost" may be chrome will let you pass.

Let's me know if that works. Good luck!

Upvotes: 0

Related Questions