- Progressive Web Application Development by Example
- Chris Love
- 67字
- 2021-08-05 10:33:21
Disabling the homescreen prompt
The beforeinstallprompt event can also be used to suppress Chrome's automatic prompt. This time, like breaking the default form submission, call the preventDefault function and return false:
window.addEventListener('beforeinstallprompt', function(e) { e.preventDefault(); return false; });
This will block the behavior in Chrome. Right now, I don't know how to suppress the prompt on other platforms as they do not support the beforeinstallprompt event yet.