File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
4
4
var History = {
5
5
6
6
/**
7
- * Sends the browser back one entry in the history, if one is available .
7
+ * Sends the browser back one entry in the history.
8
8
*/
9
9
back : function ( ) {
10
10
invariant (
Original file line number Diff line number Diff line change @@ -257,16 +257,23 @@ function createRouter(options) {
257
257
} ,
258
258
259
259
/**
260
- * Transitions to the previous URL. Returns true if the router
261
- * was able to go back, false otherwise.
260
+ * Transitions to the previous URL if one is available. Returns true if the
261
+ * router was able to go back, false otherwise.
262
+ *
263
+ * Note: The router only tracks history entries in your application, not the
264
+ * current browser session, so you can safely call this function without guarding
265
+ * against sending the user back to some other site. However, when using
266
+ * RefreshLocation (which is the fallback for HistoryLocation in browsers that
267
+ * don't support HTML5 history) this method will *always* send the client back
268
+ * because we cannot reliably track history length.
262
269
*/
263
270
goBack : function ( ) {
264
271
invariant (
265
272
typeof location !== 'string' ,
266
273
'You cannot use goBack with a static location'
267
274
) ;
268
275
269
- if ( History . length > 1 ) {
276
+ if ( History . length > 1 || location === RefreshLocation ) {
270
277
location . pop ( ) ;
271
278
return true ;
272
279
}
You can’t perform that action at this time.
0 commit comments