Commit 5c081f09 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Add random token to bare contest view request to avoid caching in Chrome

parent 3805c35b
......@@ -222,6 +222,10 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
data.insert("can_start".to_string(), to_json(&true));
// This only checks if a query string is existent, so any query string will
// lead to the assumption that a base page is requested. This is usefull to
// disable caching (via random token) but should be changed if query string
// can obtain more than only this meaning in the future
if query_string.is_none() {
data.insert("not_bare".to_string(), to_json(&true));
......@@ -131,9 +131,10 @@
// Reload page content as soon as you come back from another task via the back button in order to show the newly achieved stars
window.onpageshow = function(event) {
function reload_content(event) {
var request = new XMLHttpRequest();"GET","?bare");"GET","?bare&r=" + Math.random().toString(36).substr(2));
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.addEventListener('load', function(event) {
if (request.status >= 200 && request.status < 300) {
document.getElementById("bare_content").innerHTML = request.responseText;
......@@ -143,6 +144,8 @@
window.onpageshow = reload_content;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment