@@ -430,6 +430,7 @@ define( [
430
430
. jqmData ( "url" , dataUrl ) ;
431
431
}
432
432
433
+
433
434
// If we failed to find a page in the DOM, check the URL to see if it
434
435
// refers to the first page in the application. If it isn't a reference
435
436
// to the first page and refers to non-existent embedded page, error out.
@@ -451,7 +452,7 @@ define( [
451
452
return deferred . promise ( ) ;
452
453
}
453
454
}
454
-
455
+
455
456
// If the page we are interested in is already in the DOM,
456
457
// and the caller did not indicate that we should force a
457
458
// reload of the file, we are done. Otherwise, track the
@@ -460,11 +461,14 @@ define( [
460
461
if ( ! settings . reloadPage ) {
461
462
enhancePage ( page , settings . role ) ;
462
463
deferred . resolve ( absUrl , options , page ) ;
464
+ //if we are reloading the page make sure we update the base if its not a prefetch
465
+ if ( base && ! options . prefetch ) {
466
+ base . set ( url ) ;
467
+ }
463
468
return deferred . promise ( ) ;
464
469
}
465
470
dupCachedPage = page ;
466
471
}
467
-
468
472
var mpc = settings . pageContainer ,
469
473
pblEvent = new $ . Event ( "pagebeforeload" ) ,
470
474
triggerData = { url : url , absUrl : absUrl , dataUrl : dataUrl , deferred : deferred , options : settings } ;
@@ -494,9 +498,9 @@ define( [
494
498
$ . mobile . hidePageLoadingMsg ( ) ;
495
499
} ;
496
500
}
497
-
498
501
// Reset base to the default document base.
499
- if ( base ) {
502
+ // only reset if we are not prefetching
503
+ if ( base && typeof options . prefetch === "undefined" ) {
500
504
base . reset ( ) ;
501
505
}
502
506
@@ -530,8 +534,8 @@ define( [
530
534
RegExp . $1 ) {
531
535
url = fileUrl = path . getFilePath ( $ ( "<div>" + RegExp . $1 + "</div>" ) . text ( ) ) ;
532
536
}
533
-
534
- if ( base ) {
537
+ //dont update the base tag if we are prefetching
538
+ if ( base && typeof options . prefetch === "undefined" ) {
535
539
base . set ( fileUrl ) ;
536
540
}
537
541
@@ -1251,7 +1255,7 @@ define( [
1251
1255
if ( url && $ . inArray ( url , urls ) === - 1 ) {
1252
1256
urls . push ( url ) ;
1253
1257
1254
- $ . mobile . loadPage ( url , { role : $link . attr ( "data-" + $ . mobile . ns + "rel" ) } ) ;
1258
+ $ . mobile . loadPage ( url , { role : $link . attr ( "data-" + $ . mobile . ns + "rel" ) , prefetch : true } ) ;
1255
1259
}
1256
1260
} ) ;
1257
1261
} ) ;
0 commit comments