title: Cache issue with javascript
body: <p>I have this javascript code to detect fields changes on a page. It is working well with IE but unfortunately not in chrome. I really don't know why this is happening. When I try to access it via different browsers and units. This javascript is not working well. I need to clear my cache history to make it work properly. Here's the code:</p>
  
  <pre><code>var ctr = 1;
      var isFirstLoad = true;
  
  
      function propertyChangedByCode() {
          ctr = 0;
          propertyChanged();
      }
  
      function propertyChanged() {
          if (document.readyState == "complete") {
              $('[id$=SaveButton]').removeAttr("disabled");
              $('[id$=SaveButton]').removeAttr("class");
              $('[id$=SaveButton]').addClass("btn btn-primary");
              warnMessage = 'Warning: You have unsaved changes.';
  
              console.log(ctr);
  
              window.onbeforeunload = function () {
                  if (ctr == 0) {
                      return warnMessage
                  }
                  else if (ctr == 1) {
                      ctr = 0;
                  }
              }
          }
      }
  
      $("body").click(function (event) {
          console.log(event.target);
          if (event.target.type == "submit" &amp;&amp; event.target.value != "Save" &amp;&amp; event.target.value != "Cancel" &amp;&amp; event.target.value != "Next") {
              ctr = 0;
              propertyChanged();
              console.log("BODY clicked");
          }
      });
  
      function pageLoad() {
  
          jQuery("input.datepicker").dp({
              dateFormat: 'M d, yy',
              altFormat: 'yy-mm-dd',
              buttonText: '&lt;i class="icon icon-calendar"&gt;&lt;/i&gt;',
              showOn: 'both'
          });
  
          $("button.ui-datepicker-trigger").addClass('btn right');
  
          console.log("PageOnLoad: " + ctr);
  
          var warnMessage = 'Warning: You have unsaved changes.';
          $('input[type="text"],select,textarea').each(function (k, v) {
  
              var elem = $(this);
              // Save current value of element
              elem.data('oldVal', elem.val());
  
              // Look for changes in the value
              elem.bind("change keyup input paste", function (event) {
                  ctr = 0;
                  // If value has changed...
                  if (elem.data('oldVal') != elem.val()) {
                      propertyChanged();
                  }
              });
          });
  
          $('.btn').click(function (e) {
              console.log("whatever");
              ctr = 1;
          });
  
          //ui-datepicker-trigger
          $('.ui-datepicker-trigger').click(function (e) {
              console.log("date");
              ctr = 0;
          });
  
          if (isFirstLoad) {
              window.onbeforeunload = null;
              $('[id$=SaveButton]').attr("disabled", "disabled")
  
              console.log("Disable");
  
              isFirstLoad = false;
          }
  </code></pre>
  
  <p>So with this, I decided to take on the path on disabling caching on my system. I put this code on my master page page_load. </p>
  
  <pre><code>Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache)
  Response.Cache.SetNoStore()
  Response.Cache.SetAllowResponseInBrowserHistory(True)
  </code></pre>
  
  <p>Base on my research, these 3 lines will disable caching in my application. Tried to clear my cache, inputted some values on my field, hit save, and browse again to that page but still the fields are presenting my previous input in the autofill. So I'm assuming the disabling of caching won't work. Do you have any ideas why the disabling of caching is not workin? Do you have any suggestions regarding browsing caching? And why do you think I'm experiencing this issues that I need to clear my cache in order to make my javascript work properly? Lastly, why is it working on my IE but not in chrome? Thanks! Sorry for the load of questions. </p>