'Angular PWA on Samsung Internet Browser
Angular version: 13 Samsung Internet version: 16.2.1.56
I developed an Angular application and added PWA. Chrome and Edge display the install icon, but Samsung Internet does not.
I tested the application on the pwabuilder website and everything seems normal.
I tried this code and the alert shows true
even in Samsung browser.
<script>
alert('serviceWorker' in navigator);
</script>
and:
<button id="btn-install-app" class="btn">Install App</button>
<script>
window.addEventListener('beforeinstallprompt', e => {
e.preventDefault();
deferredPrompt = e;
});
const btnInstallApp = document.getElementById('btn-install-app');
if(btnInstallApp) {
btnInstallApp.addEventListener('click', e => {
deferredPrompt.prompt();
deferredPrompt.userChoice
.then(choiceResult => {
if(choiceResult.outcome === 'accepted') {
console.log('user accepted A2HS prompt');
} else {
console.log('user dismissed A2HS prompt');
}
deferredPrompt = null;
});
});
}
</script>
After clicking on the install button, Chrome and Edge show an install prompt, but in Samsung rowser nothing is shown.
Does anyone have any ideas?
Solution 1:[1]
I am also in the same situation (angular + pwa). In May 2022, it finally seems to work in the latest Samsung browser(ver 17.0.1.69). It's probably a Samsung browser bug.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sang Yong Sin |