Home>Article>Web Front-end> HTML5 actual combat and analysis: whether to enter the website from the home screen icon

HTML5 actual combat and analysis: whether to enter the website from the home screen icon

黄舟
黄舟 Original
2017-02-10 14:39:25 1463browse

The safari browser in the IOS system on the mobile phone can store the Webapp locally as an icon for users to view. So how do we let users enter the website from the home screen icon? We will introduce it slowly below.


The JavaScript code to determine whether to enter the website from the home screen icon is as follows##

//判断是否是从主屏幕图标进入的网站。(只针对IOS系统) if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) { alert(1) } //通过判断navigator.standalone来确定是否是从主屏幕图标来进入网站的。 //这个主要是应用在webapp端还是web端进入网站的。从而进行相应的操作。 //本例是navigator.standalone等于false即是从浏览器(web端)进入的网站的。 //那么在document文档中写入两段代码。

The above is an introduction to the actual combat and analysis of HTML5 website functions whether to enter from the home screen icon. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn