在PWA Reactjs应用程序安装前提示只会在Chrome手机和桌面浏览器中触发。我想启动或触发其他浏览器作为Chrome。我做错了什么。
在App.js中,使用useEffect添加EventListener。
useEffect(() => {
window.addEventListener("beforeinstallprompt", (e) => {
// Prevent the mini-infobar from appearing on mobile
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
// Update UI notify the user they can install the PWA
setInstallable(true);
});
window.addEventListener('appinstalled', () => {
// Log install to analytics
console.log('INSTALL: Success');
});
}, []);但不触发其他浏览器只触发chrome浏览器...
发布于 2021-02-12 22:46:18
beforeinstallprompt事件目前仅在Chrome、Edge和三星互联网上触发。Safari允许用户安装PWAs,但用户必须自己安装,单击共享按钮,然后单击添加到主屏幕。
https://stackoverflow.com/questions/66151481
复制相似问题