IOS 内容安全区域
html
<meta name="viewport" content="viewport-fit=cover" />
body {
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
padding-left: constant(safe-area-inset-left);
padding-left: env(safe-area-inset-left);
padding-right: constant(safe-area-inset-right);
padding-right: env(safe-area-inset-right);
}
// 调用 App
function callApp(schema, timeOut) {
let timer,
start = new Date().getTime();
let myPromise = new Promise((resolve, reject) => {
window.location.href = schema;
window.addEventListener("visibilitychange", () => {
if (document.visibilityState === "hidden") {
clearTimeout(timer);
resolve();
}
});
timer = setTimeout(() => {
let end = new Date().getTime();
if (end - start > timeOut + 1000) {
clearTimeout(timer);
resolve();
} else {
reject();
}
}, timeOut);
});
return myPromise;
}