diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js
index 4ef8349fa9c..9dc78f7beb6 100644
--- a/src/librustdoc/html/static/storage.js
+++ b/src/librustdoc/html/static/storage.js
@@ -28,6 +28,12 @@ function onEach(arr, func) {
function updateLocalStorage(name, value) {
if (typeof(Storage) !== "undefined") {
+ try {
+ window.localStorage;
+ } catch(err) {
+ // Storage is supported, but browser preferences deny access to it.
+ return;
+ }
localStorage[name] = value;
} else {
// No Web Storage support so we do nothing