jquery/jquery-mobile — Issue #3638: $.mobile.changePage doesn't work for local files on iPhone/osx
Author: jeremy360
Created: 2012-02-24 17:24:20+00:00
State: open

The following line:

$.mobile.changePage("test.html");

throws an error in safari and iPhone webview.

I have tracked the issue down to the following line:

2826 - thisUrl = thisUrl.replace( location.protocol + '//' + location.host + location.pathname, '' ); //version 1.0

I throws a null error. I remedied this in my project by doing the following:

if(location.protocol){
thisUrl = thisUrl.replace( location.protocol + '//' + location.host + location.pathname, '' );
}