cache avoiding hacks
This commit is contained in:
parent
5cee783d35
commit
a66f901d9a
2
quiz.js
2
quiz.js
|
@ -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')
|
||||
|
|
11
server.js
11
server.js
|
@ -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 })
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue