JQuery mobile 中的 URL 意外更改
我有一个这样的页面:
<%@ Page Title="" Language="C#" MasterPageFile="~/TekContent.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="ContentPage" ContentPlaceHolderID="PageIdContent" runat="Server">
<div data-role="page" id="pageHome">
<div data-role="header" data-position="inline">
<h1>Welcome To My App</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true">
<li><a href="#pageSignMe">Sign me up</a></li>
<li><a href="AddTag.aspx">Add Tag</a></li>
<li><a href="ShowList.aspx">Tag List</a></li>
</ul>
</div>
<div data-role="footer" class="ui-bar" id="div2">
</div>
</div>
</asp:Content>
当我单击 Tag List
时,网址从 http://localhost/MyApp/
更改为 http://localhost/ MyApp/#AddTag.aspx
。我不明白为什么 #
添加到 Tag.aspx 之前。
后来的链接更多地改变了url。例如:http://localhost/MyApp/#MyApp/AddTag.aspx?id=1
这是因为我在 AddTag.aspx 中的页面脚本无法正常工作。
我想我没有得到 JQuery 移动 URL 规则。
I have a page like this:
<%@ Page Title="" Language="C#" MasterPageFile="~/TekContent.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="ContentPage" ContentPlaceHolderID="PageIdContent" runat="Server">
<div data-role="page" id="pageHome">
<div data-role="header" data-position="inline">
<h1>Welcome To My App</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true">
<li><a href="#pageSignMe">Sign me up</a></li>
<li><a href="AddTag.aspx">Add Tag</a></li>
<li><a href="ShowList.aspx">Tag List</a></li>
</ul>
</div>
<div data-role="footer" class="ui-bar" id="div2">
</div>
</div>
</asp:Content>
When I clicked on Tag List
, url is changing from http://localhost/MyApp/
to http://localhost/MyApp/#AddTag.aspx
. I couldn't get why #
adding to before Tag.aspx.
Later links are changing url more. Like: http://localhost/MyApp/#MyApp/AddTag.aspx?id=1
this is because my page script inside AddTag.aspx isn't working properly.
I think I didn't get the JQuery mobile URL rules.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 URL 将被 jQuery Mobile 重写。您应该添加以下内容来告诉它该链接是外部链接:
请参阅:页面链接文档
Your URLs will be rewritten by jQuery Mobile. You should add the following to tell it that the link is external:
See: Page Links documentation