锚定标记在iPhone Safari中不起作用 [英] Anchor tag doesn't work in iPhone Safari

查看:90
本文介绍了锚定标记在iPhone Safari中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone Safari浏览器中遇到了一个命名定位标记问题。它适用于包括Safari在内的桌面浏览器,但不适用于移动Safari。奇怪!



例如,我的网址如下所示:

  http: //www.example.com/my-example-article-url-is-like.php#articlebottom 

上面的URL来自一个时事通讯,它应该到文章页面的底部段落,我给这样的id:

 < p id =articlebottom>段落在这里< / p> 

当我点击时事通讯上面的网址时,它会进入文章页面,但不是底部的位置我指定了id。虽然我可以看到,当它进入Safari中的目标页面时,URL中缺少#articlebottom部分。



任何想法都不胜感激!

解决方案

Opera,IE浏览器,Chrome和Firefox将继续发挥新页面的作用。但是,Safari在重定向时丢失了锚。



那么如果在<$ c之前添加 / $ c> ID标记?



旧的网址路径:
http://www.example。新网址路径:
<$ c
$ c> http://www.example.com/my-example-article-url-is-like.php/#articlebottom



另一个解决方案是,你必须删除www。并在Safari正常响应之前在URL /路径名中的锚标记之前添加正斜杠。 Firefox似乎并不在乎,而且我还没有开始在IE上进行测试。


I'm having an issue with a named anchor tag in iPhone Safari browser. It works well in desktop browsers including Safari, but not working in mobile Safari. Weird!

For example my URL looks like:

http://www.example.com/my-example-article-url-is-like.php#articlebottom

the above URL is from a newsletter and it should go to the bottom paragraph in article page which I gave id like this:

<p id="articlebottom">paragraph is here</p>

When I click the above URL from Newsletter it goes to the article page, but not the bottom para where I specify id. Although I can see that the #articlebottom part is missing from URL when it came into the targeted page in Safari.

Any thoughts would be appreciated!

解决方案

Opera, IE, Chrome and Firefox will carry over the anchor to the new page. However, Safari loses the anchor on the redirect.

So what if you add / just before the ID Tag?

Old URL Path: http://www.example.com/my-example-article-url-is-like.php#articlebottom

New URL Path: http://www.example.com/my-example-article-url-is-like.php/#articlebottom

Another solution is that you'd have to delete both "www." from the domain and add a forward slash before the anchor tag in the URL/pathname before Safari would respond properly. Firefox doesn't seem to care, and I haven't gotten to testing on IE yet.

这篇关于锚定标记在iPhone Safari中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆