2012-04-03 57 views
0

我正在做一個jQuery Mobile/Rails應用程序,並且我爲它製作了app-capable。事情是,iOS的移動應用程序不支持外部鏈接,所有鏈接以data-ajax="false"爲例。iOS應用程序外部鏈接技巧在jQuery更新後無法使用

於是我就用這個小把戲JS

if (("standalone" in window.navigator) && window.navigator.standalone) { 
    $("a[data-ajax*=false]").live('click', function(){ 
    window.location.href=this.href; 
    return false; 
    }); 
} 

這是工作很好,因爲我同時更新jQuery和jQuery Mobile的......那以來,沒有追加當我點擊鏈接...

任何想法 ?

回答

0

呃......好吧,我發現問題......似乎jQuery Mobile(1.1.0 RC1)的最後一個版本在鏈接上發生了事件,它們在點擊上進行了修改......它使href#的價值...

我找不到如何阻止它,所以,我做了一個data-href屬性與鏈路上的ADRESS並修改了一下我的代碼

if (("standalone" in window.navigator) && window.navigator.standalone) { 
    $("a[data-ajax=false]").live('click', function(e){ 
    window.location.href=this.getAttribute('data-href'); 
    return false; 
    }); 
} 
相關問題