1
我有一個應用程序,我正在開發與jquery.mobile(1.3.1)通過asp.net 4.5。jquery.mobile,asp.net,本地錨處理
第一頁由一個列表組成,該列表中的一個項目的選擇導致另一個頁面。我已經分別開發了這些頁面。
當我單擊列表中的某個項目時,第二頁顯示正確,但URL不正確。我相信這是因爲jquery.mobile攔截鏈接點擊和處理頁面轉換本身 - 我不希望這樣,並希望鏈接自然行爲。
- 的URL頁面中的問題:
http://myhost/mobile
- 我鏈接到網址:
http://myhost/mobile/NewClient.aspx
- 顯示的URL:
http://myhost/mobile/#/myhost/mobile/NewClient.aspx?ClientID...
頁面列表代碼:
<div data-role="page" id="logon" data-theme="c">
<div data-role="header" data-position="fixed">
<h1>Select location</h1>
</div>
<div data-role="content">
<asp:ListView ID="LocationList" runat="server"
ItemType="AGP.BackOffice.Model.ClientSource"
DataKeyNames="ID" SelectMethod="LocationList_SelectMethod"
OnItemDataBound="LocationList_ItemDataBound">
<LayoutTemplate>
<ul data-role="listview" data-inset="false" data-divider-theme="b">
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li data-theme="c">
<asp:HyperLink ID="HyperLink" runat="server" NavigateUrl="~/Mobile/NewClient.aspx?ClientSourceID={0}&IsMinimalDataCapture={1}"
data-transition="slide" Text="<%#: Item.Description %>" />
</li>
</ItemTemplate>
</asp:ListView>
</div>
</div>
我發現了各種聲稱內置頁面的文章在jquery.mobile處理可以如下關閉...
<script type="text/javascript">
$(document).bind("mobileinit", function() {
$.mobile.ajaxEnabled = false;
$.mobile.linkBindingEnabled = false;
});
</script>
數據角色=「頁面」分區之前我已經加入這一點,但是這都沒有區別。
任何人都可以解釋這一點嗎?我只是想讓瀏覽器處理鏈接,同時仍然利用jquery.mobile UI元素。
我還應該指出,這種行爲只能在移動設備上看到(在WP8 & iPad上測試過)。在桌面上,網址似乎沒有問題。
謝謝。
似乎你也可以指定data-ajax =「false」作爲任何元素的一個屬性,並且會阻止任何包含的元素被JQM ajax攔截。 –