为什么这个苹果触摸图标不起作用? [英] Why won't this apple-touch-icon work?

查看:167
本文介绍了为什么这个苹果触摸图标不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有以下代码:

 < link rel =apple-touch-iconhref = http://website.com/images/apple-touch-icon.png/> 

当我在Firefox中查看源代码并单击图标显示的href属性时(所以它不是404错误)。
$ b 当代码被添加到像这样的页面时http://website.com/mobile/index.php http://website.com/mobile/page.php ,并且该页面被添加到iPhone主屏幕图标可以正常工作,但是当页面url像 http://website.com/page http://website.com/index 图标不显示。

在Safari选项中提供的网站调试控制台中没有出现错误,我尝试清除缓存和Cookie。



另外,我使用< base href =http://website.com/mobile//> 网站,它显示在 http://website.com/mobile/index.php http://website.com上/索引。但是我不明白这是如何影响它的,因为apple-touch-icon使用了完整的网址。尝试使用 相对URL:

 < link rel =apple-touch-iconhref =/ images / apple-touch- icon.png/> 

它应该到您的基本目录并在 / images


I have the following code in my website:

<link rel="apple-touch-icon" href="http://website.com/images/apple-touch-icon.png" />

When I view the source in Firefox and click the href attribute the icon shows (so its not a 404 error).

When the code is added to a page like http://website.com/mobile/index.php or http://website.com/mobile/page.php and the page is added to an iPhone homescreen the icon works fine, but when the page url is like http://website.com/page or http://website.com/index the icon doesn't show up.

No errors appear in the "website debug console" provided in Safari options and I've tried clearing the cache and cookies.

Also I use the tag <base href="http://website.com/mobile/" /> website, which shows up on both http://website.com/mobile/index.php and http://website.com/index. But i can't see how that would effect it since the apple-touch-icon uses a full url.

解决方案

Try using a relative URL:

<link rel="apple-touch-icon" href="/images/apple-touch-icon.png" />

It should go to your base directory and find the icon in /images.

这篇关于为什么这个苹果触摸图标不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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