Skip to content

Commit a1254d5

Browse files
committed
Add feature detection
1 parent c39b706 commit a1254d5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/resources/script.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ function initSearch(name) {
177177
};
178178

179179
function initTypeahead() {
180-
var search = new URLSearchParams(window.location.search).get('search');
181-
if (search) {
182-
var matches = findMatches(search);
183-
if (matches.length != 0) {
184-
window.location = baseHref + matches[0].href;
185-
return;
180+
if ('URLSearchParams' in window) {
181+
var search = new URLSearchParams(window.location.search).get('search');
182+
if (search) {
183+
var matches = findMatches(search);
184+
if (matches.length !== 0) {
185+
window.location = baseHref + matches[0].href;
186+
return;
187+
}
186188
}
187189
}
188190

0 commit comments

Comments
 (0)