Disable history when browsing files locally

http://stackoverflow.com/a/32454237/3586583
This commit is contained in:
Rochet2
2016-03-19 19:35:37 +02:00
parent 116589c55a
commit e3dd72d27b

View File

@@ -530,7 +530,9 @@
// Because searching is incremental by character, only the most // Because searching is incremental by character, only the most
// recent search query is added to the browser history. // recent search query is added to the browser history.
if (browserSupportsHistoryApi()) { // Do not do this on local due to chrome security errors.
// http://stackoverflow.com/a/32454237/3586583
if (browserSupportsHistoryApi() && window.location.protocol != "file:") {
if (!history.state && !params.search) { if (!history.state && !params.search) {
history.pushState(query, "", "?search=" + history.pushState(query, "", "?search=" +
encodeURIComponent(query.query)); encodeURIComponent(query.query));
@@ -779,4 +781,4 @@
$("#main > .docblock").before(wrapper); $("#main > .docblock").before(wrapper);
}); });
}()); }());