Phonegap jqm Ajax加载外部页面没有更改导航的基本域 [英] Phonegap jqm Ajax load an external page without changes base domain of the navigation

查看:95
本文介绍了Phonegap jqm Ajax加载外部页面没有更改导航的基本域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了页面更改的问题...在phonegap它工作一次,在chrome它不工作。

I'm having an issue with the page changes... In phonegap it works once and on chrome it doesn't work.

这是代码我使用在dom中加载外部页面并打开它。移走后,它从dom中移除。

This is the code I use to load an external page in the dom and open it. After moving away it get's removed from dom.

function changeToMypage() {
    $.mobile.loadPage('http://mydomain/mypage.html', {
        prefetch: "true"
    }).done(function() {
        $.mobile.changePage('#mypageid');
    });
}
$(document).on("pagehide", "#mypageid", function() {
    $(this).remove();
}); 

在phonegap它工作的第一次,我导航到外部页面,但当我导航到本地页面并返回到外部页面停止工作(重新加载当前页面替代)
在chrome从来不工作。它似乎尝试和加载file://indexpage.html#mypageid在changepage
,但这不工作,因为我使用单页导航。

On phonegap it works the first time I navigate to the external page but when I navigate to a local page and back to the external page it stops working.(Reloads the current page in stead) In chrome it never works. It seems to try and load file://indexpage.html#mypageid in the changepage but this doesn't work because I'm using single page navigation.

我不明白pageload如何将mypage.html附加到dom以使用pageid导航到它?

I don't understand how the pageload appends the mypage.html to the dom to navigate to it with the pageid?

推荐答案

使用jQuery.mobile.navigate()解决了我的问题,但这是一个低级api方法根据 JQM文档。也许有人可以给一些额外的信息,为什么它使用这种方法,而不是changepage?

Using jQuery.mobile.navigate() solved my problem but this is a low level api method according to the JQM docs. Maybe someone could give some extra information why it works with this method and not with changepage?

这篇关于Phonegap jqm Ajax加载外部页面没有更改导航的基本域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆