继续为apple-touch-icon.png获取404's

rob*_*bby 26 safari apple-touch-icon android google-chrome ios

我们为以下两个文件持续获得404:

/apple-touch-icon-precomposed.png: 685 Time(s)
/apple-touch-icon.png: 523 Time(s)
Run Code Online (Sandbox Code Playgroud)

我一直在搜索我的移动网站存档,因为这个404的罪魁祸首,我的代码中没有任何地方可以指向apple-touch-icon.png.

Find in folder...在Sublime Text 2中执行一个零结果apple-touch-icon:

Searching 100 files for "apple-touch-icon"

0 matches across 0 files
Run Code Online (Sandbox Code Playgroud)

我们正在为webapps使用Apple meta标签:

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
Run Code Online (Sandbox Code Playgroud)

使用这些元标记会导致iPhone apple-touch-icon默认搜索吗?我们没有提供图标,但我们应该是吗?我们真的只想删除这个404.

浏览Apple的开发者文档没有提供任何强化我的理论的提示.

当我们发现这种情况发生在iOS和Android上时,无论浏览器如何,情节都会变得更加浓密.Firefox,Safari和Chrome都试图找到这个apple-touch-icon.

我使用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/, '');
            }
        }
    };
Run Code Online (Sandbox Code Playgroud)

删除后,我们仍然得到404.我很难过.任何帮助是极大的赞赏.

mr.*_*Voo 15

这些元标记的使用是否会导致iPhone默认搜索苹果触摸图标?我们没有提供图标,但我们应该是吗?我们真的只想删除这个404.

是.你补充说

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
Run Code Online (Sandbox Code Playgroud)

对于您的网站,这意味着用户可以在他的主屏幕上创建一个书签,该书签不是在Safari中打开,而是在webview中看起来像"本机"应用程序.您应该将这些图像作为主屏幕的应用程序图标提供.

这可能是您正在寻找的提示:http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html