【问题标题】:Internal / External Link Issue with jQuery MobilejQuery Mobile 的内部/外部链接问题
【发布时间】:2011-04-16 19:25:41
【问题描述】:

我有几个移动网页。其中一些是从同一个文件(index.php)内部链接的,并且工作正常。例如:#first 到#second 和#second 到#third。当我到达#third 并向外部文件 process.php(位于同一目录中)提交表单查询时,问题就来了。我可以很好地访问 process.php 文件,但我需要在此页面上插入一个超链接以链接回原始页面(#first inside index.php)。我已经尝试了几个建议,但无论我做什么,浏览器似乎都会将 index.php 附加到 URL,所以实际上是让我回到 #third 而不是 #first。

例如:http://localhost/website/third.php#index.php

我试过了:

<a href="index.php">Clicky</a>
<a href="#first">Clicky</a>
<a href="/website/index.php">Clicky</a>
<a href="..index.php">Clicky</a>
<a href="http://localhost/website/index.php">Clicky</a>

似乎所有内容都将我带回到第三页,在 URL 末尾的 # 之后附加了我要求添加的任何内容。有什么想法吗?

【问题讨论】:

    标签: php jquery mobile


    【解决方案1】:

    在 jQuery Mobile 中链接到外部页面时,您必须指定 rel="external"

    <a href="index.php#first" rel="external">Clicky</a>
    

    该链接假定index.phpprocess.php 位于SAME 目录中。如果不是,您必须稍微修改路径才能工作。

    【讨论】:

    • 嗨。感谢您的回复。是的,我试过了,它把我带到了以下 URL:localhost/website/process.php#index.php#first
    • 试试 点击
    • 谢谢。那行得通。不得不更改一些其他内部链接以完成目录链接,但现在所有链接都链接在一起。很棒的东西。
    猜你喜欢
    • 1970-01-01
    • 2014-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多