Tests for CORS violation if server cannot be accessed

Former-commit-id: 28fb64c01a0aef786303c98d277cdf672949c066 [formerly e2649d9096353c1a2686948372d489af02ef46f6]
Former-commit-id: 1e3bd0e4d8aa27dc4a0d634adda0f9f94a24cd29
This commit is contained in:
Jaifroid 2018-10-17 18:29:48 +01:00
parent a63bd3ce4e
commit f41ecc36d3
2 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,7 @@ params['version'] = "0.9.9.82 Beta-dev"; //DEV: do not set this dynamically -- i
params['packagedFile'] = "wikipedia_en_ray_charles_novid_2018-10.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
params['fileVersion'] = "wikipedia_en_ray_charles_novid_2018-10.zim (12-Oct-2018)"; //Use generic name for actual file, and give version here
params['cachedStartPage'] = false; //If you have cached the start page for quick start, give its URI here
params['kiwixDownloadLink'] = "http://download.kiwix.org/zim/"; //Include final slash
params['kiwixDownloadLink'] = "https://download.kiwix.org/zim/"; //Include final slash
params['results'] = params['results'] || 15; //Number of search results to display
params['relativeFontSize'] = ~~(getCookie('relativeFontSize') || 100); //Sets the initial font size for articles (as a percentage) - user can adjust using zoom buttons

View File

@ -352,7 +352,9 @@ define([], function () {
var xhttpTimeout = setTimeout(ajaxTimeout, 20000);
function ajaxTimeout() {
xhttp.abort();
document.getElementById('serverResponse').innerHTML = "Connection attempt timed out (failed)";
var responseMessageBox = document.getElementById('serverResponse');
responseMessageBox.innerHTML = "Connection attempt timed out (failed)";
if (/https?:|file:/.test(window.location.protocol)) responseMessageBox.innerHTML = "Browser's CORS Policy disallowed access!";
document.getElementById('serverResponse').style.display = "inline";
serverError();
return;