1

I am developing javascript code with visual studio. Everything is working wWhen I run the application first, then I changing some value of javascript variable but browser not showing right result. The old result is appearing.

        var validationResult =validate("username");
        var message = "Welcome, ";

        if (validationResult) {
            message += username;
            $("#status").css("color", "green");
        } else {
            message += "Guest";
            $("#status").css("color", "red");
        }

In this example, first run on browser shows right result, but I changed the parameter of validate method as "invalidUser" but result did not changed. I thing browser is caching values. Should I clean browser history every run? Is there any clean solution for Internet Explorer or Firefox?

barteloma
  • 6,403
  • 14
  • 79
  • 173

2 Answers2

2

I think your browser is caching resources, not values. It could also be your server who is caching.

If you have the firebug plugin/extension in firefox you can disable page caching while developing on a per site basis.

Just install firebug, open it, go to the net tab, click options (little arrow on the tab itself), select disable caches.

http://getfirebug.com/

Tom
  • 582
  • 3
  • 13
0

You can force to clean the cache with this javascript

window.location.reload(true);

with a falase argument will do the opposite

Alberto Perez
  • 1,019
  • 15
  • 17