Use dummy OfflineRequestQueue if no local storage access

pull/66/head
Oliver Tacke 2019-08-29 11:52:04 +02:00
parent eb444f252b
commit 7c123cd114
1 changed files with 15 additions and 0 deletions

View File

@ -217,6 +217,21 @@ H5P.RequestQueue = (function ($, EventDispatcher) {
*/ */
H5P.OfflineRequestQueue = (function (RequestQueue, Dialog) { H5P.OfflineRequestQueue = (function (RequestQueue, Dialog) {
let localStorageSupported;
try {
localStorageSupported = (window.localStorage !== undefined);
}
catch (exception) {
localStorageSupported = false;
}
if (!localStorageSupported) {
// Return dummy class with the same interface, but which does nothing:
return function () {
this.add = function () {};
};
}
/** /**
* Constructor * Constructor
* *