Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

android - Add to homescreen on mobile phone

How can I code a button to make a shortcut for mobile phone especially on iPhone and Android.

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.

now I have a button in my html that is setup like this

<a href="#"><img src="img/button-shortcut.jpg" /></a>

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"

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.

Can someone enlighten me?

Thanks!

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

Some sites use JavaScript to present the user with a little popup, like this:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...