jQuery Mobile的内部/外部链接问题

时间:2011-04-16 19:25:42

标签: php jquery mobile

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

EG: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结尾处的#后添加任何内容。有什么想法吗?

1 个答案:

答案 0 :(得分:3)

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

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

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