JQuery mobile 中的 URL 意外更改

发布于 2024-12-01 01:55:08 字数 1313 浏览 0 评论 0原文

我有一个这样的页面:

<%@ 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海里的那抹蓝 2024-12-08 01:55:08

您的 URL 将被 jQuery Mobile 重写。您应该添加以下内容来告诉它该链接是外部链接:

<li><a href="AddTag.aspx" rel="external">Add Tag</a></li>

请参阅:页面链接文档

Your URLs will be rewritten by jQuery Mobile. You should add the following to tell it that the link is external:

<li><a href="AddTag.aspx" rel="external">Add Tag</a></li>

See: Page Links documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文