關於JQueryMobile 連接到自定義的外部html頁面的Error Loading Page問題的解決

關於JQueryMobile的Error Loading Page問題的解決



默認情況JQUERY MOBILE會捕獲對鏈接點擊的事件,試圖通過AJAX的方式載入目標頁面。但如果目標頁面是302重定向的方式,則會彈出Error Loading Page的錯誤。
折騰了很久,也嘗試通過

            $(document).bind("mobileinit", function(){

                 $.mobile.ajaxEnabled=false;

            });
來禁止之,但一直無效。
最後找到一段話:
To disable pages loading through Ajax bind 'mobileinit' and override $.mobile.ajaxEnabled (You need to bind 'mobileinit' before referencing the jQuery mobile script) or add data-ajax="false" or rel="external" to the link element.

添加了之後一切OK。

<a href="gonggao.html" rel="external">&#xe01d; 公告</a>   從首頁home.html連接到gonggao.html

參考:
http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-mobile-example.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章