cache avoiding hacks

This commit is contained in:
Astro 2010-12-21 22:47:57 +01:00
parent 5cee783d35
commit a66f901d9a
2 changed files with 11 additions and 2 deletions

View File

@ -32,7 +32,7 @@ var questions;
var currentQuestion = 0;
function loadQuizData(done) {
$.ajax({ url: 'data/questions.json',
$.ajax({ url: 'data/questions.json?' + Math.round(Math.random() * 1000),
contentType: 'json',
success: function(data, status) {
if (typeof data === 'string')

View File

@ -87,11 +87,20 @@ function pushIrcInfo() {
/*
* Web server
*/
function noCache(req, res, next) {
var writeHead = res.writeHead;
res.writeHead = function(status, headers) {
headers['Cache-Control'] = 'no-cache';
writeHead.call(this, status, headers);
};
next();
}
var server = Connect.createServer(
Connect.logger(),
noCache,
Connect.bodyDecoder(),
Connect.staticProvider(__dirname),
Connect.staticProvider({ root: __dirname, maxAge: 1000 }),
Connect.errorHandler({ dumpExceptions: true, showStack: true })
);