English 中文(简体)
jjQuery 移动散列链接在第一次点击链接后被缓存到 Shift+f5
原标题:jQuery Mobile hash links getting cached after first clicked link until shift+f5

我有一个网站 使用jQuery移动图书馆, 有几个链接 看起来像如下:

<a href="#news?A">News for A zipcode</a>
<a href="#news?B">News for B</a>
<a href="#news?C">News for C</a>

首先点击的链接似乎都会被浏览器缓存, 以获取所有具有相同 news 前缀的后继链接。 例如...

  1. User clicks on 2nd link to #news?B, the browser correctly goes to #news?B
  2. User clicks back button, is taken back home
  3. User clicks on 1st link to #news?A, the browser INcorrectly goes to #news?B (cached from step 1?)

如果我再次转换到f5, 不论我点击哪个链接, 在那之后, 成为从那个点往前的“ 焦” 链接。 有什么想法吗? 我用用户代理交换器在手机和 Chrome 测试了这个链接( 假冒浏览器, 认为它是一个移动设备 ) 。

Edit -我想我在这里找到了答案,>http://jquerymobile.com/test/docs/pages/pages/page-hil动性.html 。在更新此 s.o. 问题之前,将测试和验证。

问题回答

试着像这样使用它

<a href="#news_A">News for A zipcode</a>
<a href="#news_B">News for B</a>
<a href="#news_C">News for C</a>

更改代码以使用 代替 ? 如果您在别处访问它,

Also you can use safari to test it for iPhone or iPad more precisely than chrome s UA switcher. Chrome is good for Android testing though. You have to go preferences and enable developer menu. In developer menu you will have options to switch user agent.

我找到了问题所在,hash. 位置没有更新到点击/挂载的链接(剧场)。

我用数据- URL 属性来拉动正确信息 :

示例:

$(document).on( pagechange , function (e, o) {
    var dataURL = $( #theater ).attr( data-url ); // Use this for the Theater Location as hash is not updating
    var hash = location.hash;
    var action = hash.split( ? )[0]; // #whatshot, #showtimes, #zip?{zip}, #theater?{zip},{theaterId}
    var args = dataURL.split( ? )[1].split( , );
    var zip = args[0];
    var theaterId = args[1];

    // load theater movies
    codejkjk.movies.Api.GetTheaterMovies(codejkjk.movies.Mobile.Currents.ShowtimeDay(), codejkjk.movies.Mobile.Currents.ZipCode(), theaterId, function (theater) {
        codejkjk.movies.Mobile.Controls.CurrentTheater().html(theater.name);
        codejkjk.movies.Mobile.Controls.TheaterMovieList().html(
            codejkjk.movies.Mobile.Controls.TheaterMovieTemplate().render(theater)
        ).show().listview( refresh ); //.trigger( create );

        // set theaterMovieBackUrl
        theaterMovieBackUrl = hash; // set back url to current url

        $.mobile.hidePageLoadingMsg();
    });
});

我在铬控制台使用此函数





相关问题
How can I make mobile version of an existing web site?

We have a website coded with jsp-Java. Now, we want to show our website more user friendly on blackberry etc. Is there any tool or method to do this issue more easier? thanks for your answers.

Should I make my mobile application for Mobile 6 or Mobile 5?

I am going to be making a small application very soon. I am wondering would it be better to go and make it for 6.0 or should I make it for 5.0? I don t know much about both versions but I guessing ...

How do I combine @font-face and @media declarations?

I d like to build a common typography stylesheet with a very small number of selectors. As such, I d far prefer to use @media sections for the various versions rather than create different files, each ...

热门标签