Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2ebf931

Browse files
committed
fix($location): re-assign location after BFCache back
In the Android browser, the BFCache maintains the state of JavaScript applications even when navigating to another app, so that going forward and back, to and from an application is very fast. Unfortunately, this can have undesired side effects. In this instance, the location variable was holding a reference to a stale window.location, and was throwing errors when going back to an Angular app after browsing to another site. This fix makes sure that location.url() includes a check to make sure that location is referencing the current window.location. Closes #4044
1 parent 8727fce commit 2ebf931

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ng/browser.js

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ function Browser(window, document, $log, $sniffer) {
148148
* @param {boolean=} replace Should new url replace current history record ?
149149
*/
150150
self.url = function(url, replace) {
151+
// Android Browser BFCache causes location reference to become stale.
152+
if (location !== window.location) location = window.location;
153+
151154
// setter
152155
if (url) {
153156
if (lastBrowserUrl == url) return;

0 commit comments

Comments
 (0)