我们继续得到404的以下两个文件:
/apple-touch-icon-precomposed.png: 685 Time(s)
/apple-touch-icon.png: 523 Time(s)
我一直在研究我的移动网站归档的罪魁祸首到这个404,没有地方在我的代码,指向apple-touch-icon.png。
在Sublime Text 2中执行在文件夹中查找…为apple-touch-icon提供零结果:
Searching 100 files for "apple-touch-icon"
0 matches across 0 files
我们正在使用Apple元标记用于webapps:
这些元标记的使用会导致iPhone默认搜索苹果触摸图标?我们不提供图标,但我们应该是吗?我们真的只想删除404。
当我们发现这是发生在iOS和Android,不管浏览器,情节变得更加厚。 Firefox,Safari和Chrome都在试图找到这个苹果触摸图标。
我使用HTML5 Mobile Boilerplate作为我的WebApp的启动器,它有一个名为helper.js的文件。 helper.js里面有这个函数,我从我们的代码中删除:
/**
* iOS Startup Image helper
*/
MBP.startupImage = function() {
var portrait;
var landscape;
var pixelRatio;
var head;
var link1;
var link2;
pixelRatio = window.devicePixelRatio;
head = document.getElementsByTagName('head')[0];
if (navigator.platform === 'iPad') {
portrait = pixelRatio === 2 ? 'img/startup/startup-tablet-portrait-retina.png' : 'img/startup/startup-tablet-portrait.png';
landscape = pixelRatio === 2 ? 'img/startup/startup-tablet-landscape-retina.png' : 'img/startup/startup-tablet-landscape.png';
link1 = document.createElement('link');
link1.setAttribute('rel', 'apple-touch-startup-image');
link1.setAttribute('media', 'screen and (orientation: portrait)');
link1.setAttribute('href', portrait);
head.appendChild(link1);
link2 = document.createElement('link');
link2.setAttribute('rel', 'apple-touch-startup-image');
link2.setAttribute('media', 'screen and (orientation: landscape)');
link2.setAttribute('href', landscape);
head.appendChild(link2);
} else {
portrait = pixelRatio === 2 ? "img/startup/startup-retina.png" : "img/startup/startup.png";
portrait = screen.height === 568 ? "img/startup/startup-retina-4in.png" : portrait;
link1 = document.createElement('link');
link1.setAttribute('rel', 'apple-touch-startup-image');
link1.setAttribute('href', portrait);
head.appendChild(link1);
}
//hack to fix letterboxed full screen web apps on 4" iPhone / iPod
if ((navigator.platform === 'iPhone' || 'iPod') && (screen.height === 568)) {
if (MBP.viewportmeta) {
MBP.viewportmeta.content = MBP.viewportmeta.content
.replace(/\bwidth\s*=\s*320\b/, 'width=320.1')
.replace(/\bwidth\s*=\s*device-width\b/, '');
}
}
};
删除后,我们仍然得到404的。我被骗了。任何帮助是极大的赞赏。