所以我正在 iFraming 另一个网站,我希望我的用户将该网站添加到主屏幕并从那里使用它。但是当我尝试使用其他网站的代码时,它不起作用。
最佳答案
将这些元标记包含在 <head>
中您的index.html
文件。在 iOS 上,这将模拟一个可以添加到主屏幕的 Web 应用程序。
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="AppTitle">
<link rel="apple-touch-icon" href="/custom_icon.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="180x180" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="167x167" href="touch-icon-ipad-retina.png">
<link rel="apple-touch-startup-image" href="/launch.png">
为了让每个设备正确加载图标和启动图像,您的图像必须具有下面链接的 Apple UI 指南中描述的精确尺寸。如果图像未指定这些尺寸,则不会加载。
此要点还显示所有可用的元标记:https://gist.github.com/tfausak/2222823
关于javascript - 如何使 web 应用程序在 web 应用程序中打开链接而不是 safari,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41202724/