-
Notifications
You must be signed in to change notification settings - Fork 27.5k
undefined TypeError: Cannot call method 'replace' of undefined in Android Browser #4044
Comments
This is the line in question: https://github.com/angular/angular.js/blob/v1.0.x/src/ng/browser.js#L177 |
From this function, right near the bottom,
|
Looks like android has some issues with $location. See #3814. |
This is from a webapp. Just accessing the app. When I switched out my current angular version with 1.2.0-rc.2 I got a bunch of errors so I'll make a new sample app to confirm with rc2. By tomorrow morning most likely. |
Created test project that showcases issue: ajcrites/ng-loc-demo@8ab4b2b Identical issue persists in latest Angular dev version: ajcrites/ng-loc-demo@01ff49f Issue is related to bfcache. It seems the ng app will not work properly if the page is loaded from bfcache -- at least in some browsers. Thanks to @tkayali |
@petebacondarwin We apologize for the delay in getting back to you. It's been a hectic week. |
Here's a simple plunkr reproducing the issue. http://plnkr.co/edit/OR7xH9QeCDsGpGpFOg9e Clicking login, then visiting google.com, then going back will cause the error to be thrown in the Android browser. |
@ajcrites looks like BFCache is causing |
@ajcrites, @playpianolikewoah and @tkayali when you have a chance, could you test your app with this build? http://ci.angularjs.org/job/angular.js-jeff/66/artifact/build/angular.js |
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 angular#4044
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 angular#4044
In Android browser I use
$location.path('/login');
to route. Example:When I navigate away to say google.com and press back when clicking on a link the routing becomes unavailable and I get this error from line 3268 from angular.js version 1.0.8:
undefined TypeError: Cannot call method 'replace' of undefined
Everything stops working at that point.
The text was updated successfully, but these errors were encountered: