gpt4 book ai didi

Iphone Web 应用程序启动屏幕延迟

转载 作者:行者123 更新时间:2023-12-03 21:05:23 25 4
gpt4 key购买 nike

我制作了一个简单的 iPhone Web 应用程序,并设置了启动屏幕和图标以及所有内容。这是link到它。

我遇到的问题是,当我将 Web 应用程序保存到主屏幕时,在启动屏幕之前会先显示一个白屏(或者是我在 Safari 上打开的页面的屏幕截图)几秒钟。

我添加了其他 iPhone 网络应用程序,例如 JQtouch到我的主屏幕并打开它们,启动屏幕立即显示。

我想知道我的 html 代码是否有问题???

最佳答案

尝试更改<meta name="viewport" content="width=300px; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />所以width=device-width并使用逗号( , )代替分号( ; ),除非在行尾。

<小时/>

你的<head>中有这个吗? :

<link rel="apple-touch-startup-image" href="myImage.jpg">

参见iOS Web App Configuration - mobile-meta-links.html确切的规范:

<!-- startup image for web apps - iPad - landscape (748x1024) 
Note: iPad landscape startup image has to be exactly 748x1024 pixels (portrait, with contents rotated).-->
<link rel="apple-touch-startup-image" href="img/ipad-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" />

<!-- startup image for web apps - iPad - portrait (768x1004) -->
<link rel="apple-touch-startup-image" href="img/ipad-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" />

<!-- startup image for web apps (320x460) -->
<link rel="apple-touch-startup-image" href="img/iphone.png" media="screen and (max-device-width: 320px)" />
<小时/>

另请注意,只有使用 HTML5-doctype 时才会显示启动图像 <!DOCTYPE html>

<小时/>

来自Icons and splash screens for iOS web apps - retina displays also welcome :

To insert a high-resolution splash screen into the <head>, but only for iOS devices with a retina display running iOS5 or later:

function hasRetinaDisplay() {
return (window.devicePixelRatio >= 2);
}
function isAppleDevice() {
return (/iphone|ipod|ipad/gi).test(navigator.platform);
}
function iOSNewerThan(majorVersion) {
if(isAppleDevice()) {
// Check the version
var pattern = /iPhone OS (.*) like Mac/;
var result = navigator.userAgent.match(pattern); // Returns "iPhone OS X_Y like Mac, X_Y"
var version = result[1].split(''); // Returns X, Y
var release = version[0];
return (release >= majorVersion);
}
return false;
}

// When we're ready to go...
$(document).ready(function() {
if(hasRetinaDisplay() && iOSNewerThan(5)) {
var highResSplash = '<link rel="apple-touch-startup-image" href="/images/splash-iphone4.png" />';
$('head').append(highResSplash);
}
});

关于Iphone Web 应用程序启动屏幕延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7731355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com