Skip to content

Commit

Permalink
Ensure reloads occur when the URL contains a hash.
Browse files Browse the repository at this point in the history
When reloading a URL that contains a hash (e.g. `/page#target`) after an error,
assigning to `window.location.href` is not enough.  Explicitly call
`window.location.reload()` to ensure a reload happens.

Closes youtube#377.
  • Loading branch information
nicksay committed Jan 6, 2016
1 parent 3ee29f8 commit 5a42346
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/client/nav/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,10 @@ spf.nav.reload = function(url, reason, opt_err) {
url = spf.url.appendParameters(url, params);
}
window.location.href = url;
// If the new url contains a hash and the path is the same for both the new
// and the old urls, then just assigning to `location.href` is not enough to
// trigger a reload. Explicitly call `location.reload()` to be sure.
window.location.reload();
}, 0);
};

Expand Down

0 comments on commit 5a42346

Please sign in to comment.