Remove query parameters when leaving search results
This commit is contained in:
parent
323fb7113b
commit
eeb5552667
1 changed files with 6 additions and 1 deletions
|
|
@ -101,7 +101,7 @@ function focusSearchBar() {
|
|||
getSearchInput().focus();
|
||||
}
|
||||
|
||||
// Removes the focus from the search bar
|
||||
// Removes the focus from the search bar.
|
||||
function defocusSearchBar() {
|
||||
getSearchInput().blur();
|
||||
}
|
||||
|
|
@ -220,6 +220,11 @@ function defocusSearchBar() {
|
|||
addClass(search, "hidden");
|
||||
removeClass(main, "hidden");
|
||||
document.title = titleBeforeSearch;
|
||||
// We also remove the query parameter from the URL.
|
||||
if (browserSupportsHistoryApi()) {
|
||||
history.replaceState("", window.currentCrate + " - Rust",
|
||||
getNakedUrl() + window.location.hash);
|
||||
}
|
||||
}
|
||||
|
||||
// used for special search precedence
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue