2

So I'm using a WAMP server and Chrome to test a website I'm building and I often have an issue where I change the content of files and reload the page (even in a new window), and don't see the changes. Viewing the code in the debugger I still see the old code from before I saved out the changes.

My fix to this problem is that whenever it happens (which seems random) I have to clear my browser cache and restart the WAMP server, but this is a royal pain and I'm wondering if anyone knows a better solution (maybe some setting in Chrome or WAMP that I'm missing) to avoid this constant speed bump.

ANSWERS:

With jQuery (by Willy Wonka):

$.ajaxSetup({cache: false});

Without jQuery (by cowgod):

<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>

disabling the browser cache in php or using javascript

Thanks Willy Wonka for pointing me in the right direction.

Community
  • 1
  • 1
Zatoichi
  • 23
  • 1
  • 4

2 Answers2

2
$.ajaxSetup({cache: false});

Use jQuery to disable cache for your website.

Willy Wonka
  • 459
  • 5
  • 12
2

A simpler way would be to use the debugger to disable the cache.

Press F12 Then click the Gear icon in the bottom right of the page Select the General Tab under Settings Check the box called Disable Cache

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149