From fb80af778aea1ff00d47e2ffb5d2950061ee5a42 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 24 Mar 2015 20:24:44 +0100 Subject: Add cache buster when development is enabled --- js/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/main.js b/js/main.js index 34e0890..f3a59a4 100644 --- a/js/main.js +++ b/js/main.js @@ -3,6 +3,11 @@ define(function() { var all_pages = 'home studying curriculum campus career'.split(' '); + var cacheBuster = ''; + if (/dev/.test(location.search)) { + cacheBuster = '?t=' + (new Date()).getTime(); + } + /* loads a page into view and execute scripts */ function loadContent(name, text) { var contentElement = document.getElementById('content'); @@ -35,7 +40,7 @@ define(function() { http.onload = function() { loadContent(page, http.responseText); }; - http.open('get', 'pages/' + page + '.html'); + http.open('get', 'pages/' + page + '.html' + cacheBuster); http.send(null); return true; } -- cgit v1.2.1