Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Make changePage working properly on PhoneGap with WP7 #5235

wants to merge 1 commit into from

4 participants


WP7 with PhoneGap uses different local file name which has form like:
Currently navigation helper assumes that every URL has double slash in url which is not the case in this situation. I added fix which always checks if there is double slash necessary for given url. That makes this working for all tradtional urls, as well as for WP7.



I experiment a similar problem using $.mobile.changePage with WP7. However I'm a bit new to github and the pull request system.

How can I use your fix in my code? Can I download your version of js/ and include it in my js files?



I think easiest way to test @gziolo his solution is making the changes manually. If you click at the "Files Changed" tab at the top of this pull request you see the changes he suggest.
Make sure you use latest code for testing:


Yes this was my first try but I wasn't able to find the code to replace in my JQM js file, which might be because I was using the minified one.

Anyway I tried again using as you suggested and it worked! However I had to change something in the code from @gziolo. Replace var url by var uri in:

var url = this.parseUrl( url || location.href ),
hash = uri.hash;

Now $.mobile.changePage works correctly on WP7. Thanks @gziolo and @uGoMobi for the help.

I expriment other troubles on WP7 now: my JQM pop up windows are all showed, and at the end of the page. Any chance it could come from the modified getLocation function?


I confirm this must be related to the getLocation changes since I tested the code on Android and the same bug occurs (which is not the case with th original code).


closing this because this function no longer exists

@arschmitz arschmitz closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 30, 2012
This page is out of date. Refresh to see the latest.
6 js/
@@ -53,8 +53,8 @@ define( [
// browsers that auto decode it. All references to location.href should be
// replaced with a call to this method so that it can be dealt with properly here
getLocation: function( url ) {
- var uri = url ? this.parseUrl( url ) : location,
- hash = this.parseUrl( url || location.href ).hash;
+ var url = this.parseUrl( url || location.href ),
+ hash = uri.hash;
// mimic the browser with an empty string when the hash is empty
hash = hash === "#" ? "" : hash;
@@ -62,7 +62,7 @@ define( [
// Make sure to parse the url or the location object for the hash because using location.hash
// is autodecoded in firefox, the rest of the url should be from the object (location unless
// we're testing) to avoid the inclusion of the authority
- return uri.protocol + "//" + + uri.pathname + + hash;
+ return uri.protocol + uri.doubleSlash + + uri.pathname + + hash;
parseLocation: function() {
4 tests/unit/navigation/navigation_helpers.js
@@ -250,6 +250,10 @@
equal( $.mobile.path.getLocation( allUriParts ), allUriParts.replace( "jblas:password@", "") );
+ test( "path.getLocation works properly on WP7 with PhoneGap", function() {
+ equal( $.mobile.path.getLocation("x-wmapp1:/app/www/index.html"), "x-wmapp1:/app/www/index.html" );
+ });
test( "calling mobile back uses phonegap's navigator object when present", function() {
var previous = $.mobile.phonegapNavigationEnabled;
Something went wrong with that request. Please try again.