diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 4a0334527746..31fe043b7909 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -697,6 +697,9 @@
// Push and pop states are used to add search results to the browser
// history.
if (browserSupportsHistoryApi()) {
+ // Store the previous
so we can revert back to it later.
+ var previousTitle = $(document).prop("title");
+
$(window).on('popstate', function(e) {
var params = getQueryStringParams();
// When browsing back from search results the main page
@@ -705,6 +708,9 @@
$('#main.content').removeClass('hidden');
$('#search.content').addClass('hidden');
}
+ // Revert to the previous title manually since the History
+ // API ignores the title parameter.
+ $(document).prop("title", previousTitle);
// When browsing forward to search results the previous
// search will be repeated, so the currentResults are
// cleared to ensure the search is successful.