Jquery mobile jQuery手机问题获取当前页面的url(在chrome桌面上运行良好)

Jquery mobile jQuery手机问题获取当前页面的url(在chrome桌面上运行良好),jquery-mobile,Jquery Mobile,你知道为什么吗 $('#site-toggle').live('tap', function () { url = $.mobile.path.parseUrl("http://" + window.location.host.replace('m.','') + window.location.pathname); window.location.href=url.href; }); 在桌面上的chrome上工作,但在我的Android上不工作 在Chrome上,它会获取您现

你知道为什么吗

$('#site-toggle').live('tap', function () {
    url = $.mobile.path.parseUrl("http://" + window.location.host.replace('m.','') + window.location.pathname);
    window.location.href=url.href;
});
在桌面上的chrome上工作,但在我的Android上不工作


在Chrome上,它会获取您现在所在的页面,但在我的Android上,它将始终重定向到加载的第一个页面。

窗口上运行
替换
怎么样。location.href
属性

$('#site-toggle').live('tap', function () {
    window.location.href = window.location.href.replace('m.','');
});

这是在pagecreate eventOn中,Android仍将加载您访问的第一个页面,而不是您所在的页面(我启用了默认的jQuery Mobile ajax导航)
$('#site-toggle').live('tap', function () {
 var fullSiteURL = 'http://' + location.host.replace('m.', '') +  $(e.target).attr('data-url');
 window.location.href = fullSiteURL;
});