Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio not updating html / javascript to server / browser

This is an MVC 4 app using the Hot Towel SPA template. Whenever I change anything in the HTML and/or javascript the only way I can get the new code to display is to clear the browser cache. F5, cntrl-F5, shift-F5, nothing works.

I'm not normally a web dev and just learning this. I've done regular MVC before and not had this issue, maybe it has to do with where the HTML and javascript is in my project (i.e. in the /App folder) ?. I'm going nuts trying to figure this out.

I can completely delete an HTML file and run the app and it still runs as it did. Clear cache and run and I then get the update.

It's running using IIS express using Firefox, Chrome, IE...

Thanks..

like image 1000
Brian Avatar asked Mar 26 '13 20:03

Brian


People also ask

Why JS file is not reflected in browser?

This is because those . css and . js files have been cached in the browser.

How do I link a JavaScript file to HTML in Visual Studio?

1) Right-click “utilities” folder on Visual Studio and select “Add -> Existing item”. 2) Select the file to add, clicking on it ONCE (do not double-click). 3) Click in the arrow next to the “Add” button and select “Add As Link”.

Where do I put JavaScript code in Visual Studio?

With your project open in Visual Studio, right-click on a folder or your project node in Solution Explorer (right pane), and choose Add > New Item. In the New File dialog box, under the General category, choose the file type that you want to add, such as JavaScript File, and then choose Open.

How do I open Visual Studio code in HTML browser?

In the Visual Studio Code Explorer, right-click on your new file. Select “Open Live Server.” The HTML file will open in the browser. Once it does, try to edit the HTML code.


2 Answers

In Opera and Chrome (and possibly others), you can disable caching while in 'development mode'.

While in DevTools, the 2nd option in the Settings menu is

Disable cache (while DevTools is open)

like image 166
Mark Hebert Avatar answered Oct 08 '22 06:10

Mark Hebert


Go to your web.config file and make a change in it.Its not matter what change you make.For example type a character and then delete it and build the project and run it again.I hope it works.

like image 44
Hamid Reza Avatar answered Oct 08 '22 07:10

Hamid Reza