diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 9d84d4ea3c1..5b0b19b95af 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -54,7 +54,8 @@
}
function browserSupportsHistoryApi() {
- return window.history && typeof window.history.pushState === "function";
+ return document.location.protocol != "file:" &&
+ window.history && typeof window.history.pushState === "function";
}
function highlightSourceLines(ev) {