Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery mobile 在Cordova的JQuery Mobile中使用changePage(PhoneGap)_Jquery Mobile_Cordova - Fatal编程技术网

Jquery mobile 在Cordova的JQuery Mobile中使用changePage(PhoneGap)

Jquery mobile 在Cordova的JQuery Mobile中使用changePage(PhoneGap),jquery-mobile,cordova,Jquery Mobile,Cordova,我已经下载了我的JQuery移动应用程序的文件结构。我这样做是为了测试从本地文件系统运行它。原因是我希望我的应用程序运行Cordova。据我所知,cordova在file:///下运行文件。当前,我的文件结构如下所示: index.html account register.html reset.html 在index.html中,我有一个注册按钮。当有人单击它时,我使用以下代码: $.mobile.changePage("account/register.html", { trans

我已经下载了我的JQuery移动应用程序的文件结构。我这样做是为了测试从本地文件系统运行它。原因是我希望我的应用程序运行Cordova。据我所知,cordova在file:///下运行文件。当前,我的文件结构如下所示:

index.html
account
  register.html
  reset.html
在index.html中,我有一个注册按钮。当有人单击它时,我使用以下代码:

$.mobile.changePage("account/register.html", { transition: "slide" });
我已经验证过,如果我将完整路径放入浏览器url中,register.html工作正常。奇怪的是,当我单击“注册”时,我看到错误加载页面。在文件://下使用changePage是否有问题。如果是的话,我如何克服这个问题

谢谢大家!

试试这个

$.mobile.changePage("../account/register.html", { transition: "slide" });

您只需在代码中留下链接,它就可以正常工作。除非你有明确的理由打电话给changePage。

如果你在iOS上运行PhoneGap应用程序时遇到问题,这个答案是明确的

确保将$.mobile.allowCrossDomainPages设置为true;这是AJAX调用注入页面所必需的

在PhoneGap应用程序对象定义中:

变量应用={ 初始化:函数{ //使用$.mobile.changePage所需的设置 // http://jquerymobile.com/demos/1.2.0/docs/pages/phonegap.html $.mobile.allowCrossDomainPages=true; }, }; 因此,当您在index.html中调用app.initialize时,此属性将在任何$.mobile.changePage函数调用之前设置


由于Safari Web Inspector不会返回任何错误,因此这将为您节省数小时的解决问题的时间。

这是如何解决问题的?在本例中显示index.html时,当前目录是什么?