在手机上添加到主屏幕 [英] Add to homescreen on mobile phone
问题描述
如何编写一个按钮来为手机创建快捷方式,尤其是在 iPhone 和 Android 上.
How can I code a button to make a shortcut for mobile phone especially on iPhone and Android.
我使用样板作为框架,因此它会自动将其添加到 head 部分 <link rel="shortcut icon" href="img/l/apple-touch-icon.png">代码>.我认为这将是我要使用的默认图标.
I'm using boilerplate as a framework so it would automatically be adding this on the head section <link rel="shortcut icon" href="img/l/apple-touch-icon.png">
. I think this would be my default icon to be used.
现在我的 html 中有一个按钮是这样设置的
now I have a button in my html that is setup like this
<a href="#"><img src="img/button-shortcut.jpg" /></a>
我不确定在我的 href
中放什么,或者我应该使用 javascript 来实现它.我也不确定什么是正确的术语,我只是猜测它被称为捷径"
I'm not sure what to put in my href
or should I implement it using javascript. I'm also not sure what is the proper term, I'm just guessing it's called as a "shortcut"
我想要实现的是,我有一个简单的网络应用程序(纯 html),我有一个按钮可以在他们的主屏幕上添加快捷方式/图标.这样他们就可以更轻松地访问我的网站/网络应用程序.我的目标设备主要是 iphone 和 android.
What' I'm trying to achieve is, I have a simple web app (plain html) and I have a button to add a shortcut/icon on their homescreen. That way it's easier for them to access my website/web app. My target devices are iphone and android primarily.
有人能指教我吗?
谢谢!
推荐答案
您无法在 iOS 上为此功能创建快捷链接,我也不知道在 Android 上有什么方法.iOS 用户必须使用 Safari 工具栏向主屏幕添加内容.
You can't make a shortcut link for this functionality on iOS, and I'm not aware of a way on Android either. iOS users have to use the Safari toolbar to add something to the home screen.
有些网站使用 JavaScript 向用户展示一个小弹出窗口,如下所示:
Some sites use JavaScript to present the user with a little popup, like this:
这篇关于在手机上添加到主屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!