Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 caching older version of .js file

I am working on a small web api project in Visual Studio 2013 Ultimate. Windows 2013. Internet Explorer 9. When I run (debug) from VS using the internal web server (I guess that is IIS Express, now), I am finding that the changes I am making (and saving) to a javascript page are being ignored. Placing a breakpoint in the javascript shows the older code without my changes.

CTRL+F5 does not force the application to use the currently updated page. Checking the page in, then checking it back out often works. Is there some setting or trick that will help me out here?

like image 784
Joe Avatar asked Mar 30 '14 02:03

Joe


People also ask

Do JS files get cached?

JavaScript and CSS files are usually cached in the browser after the first access. The browser cache is used to store web application assets like images, CSS, and JS code on your computer's hard drive.

Where are .JS files stored?

Javascript files are stored on the server. They're sent to the browser the same way HTML, CSS and image files are sent.

Does IIS cache js files?

It turns out that IIS 7 will automatically cache static resources, such as JavaScript files.


2 Answers

Clearing the cache history seemed a bit excessive and I don't want to do that all the time.

The following solution worked me in Internet Explorer: First enable script debugging:

  1. Tools menu -> select Internet Options
  2. On advance tab uncheck "Disable script debugging (Internet Explorer)"

Then make sure you get the newest page:

  1. From the Tools menu choose Internet Options.
  2. On the General tab, under Browsing history, click Settings.
  3. Under "Check for newer versions of stored pages" make sure "Every time I visit the webpage" is selected.
  4. Click the OK button.
like image 63
sunnyboy Avatar answered Oct 11 '22 16:10

sunnyboy


If somebody has this problem and ctrl+F5, clearing browser's cache, restarting debugging, changing browser, changing web.config and rebuilding project don't help, then there is one last thing that works (at least for me): restart Visual Studio.

Also changing debugging port on local IIS Express helps but this is far more painful if working in a team or using Azure Active Directory etc.

like image 37
Episodex Avatar answered Oct 11 '22 16:10

Episodex