From 36882a00074b0a444041f5348146ad66343c3e59 Mon Sep 17 00:00:00 2001 From: Nick Howell Date: Wed, 1 Jul 2015 23:28:54 -0400 Subject: [PATCH] rustdoc: Reset the title when pressing the back button Fixes #26673 --- src/librustdoc/html/static/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 4a03345277466..31fe043b79098 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.