- Cantonese
- var dfdPrompt=null; var installPromptDiv=document.getElementById('install-prompt'); function shouldShowInstallPrompt(){const oneDay=168*60*60*1000; const lastClosed=localStorage.getItem('installPromptClosed'); if(lastClosed){const now=Date.now(); return now-lastClosed>oneDay}return true}function showInstallPrompt(){if(dfdPrompt&&shouldShowInstallPrompt()){installPromptDiv.style.display='block'}}function closePrompt(){installPromptDiv.style.display='none'; localStorage.setItem('installPromptClosed',Date.now())}window.addEventListener('beforeinstallprompt',function(e){dfdPrompt=e; e.preventDefault(); showInstallPrompt()}); function addToDesktop(){if(dfdPrompt){dfdPrompt.prompt(); dfdPrompt.userChoice.then(function(choiceResult){console.log(choiceResult.outcome); closePrompt(); dfdPrompt=null})}else{console.log('添加到主屏幕的功能不可用。 ')}}window.onload=showInstallPrompt;
- G
0 - R
0 - Taiwan
3 -
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/template/hdtv/assets/app/service-worker.js')
.then(registration => {
console.log('Service Worker registered:', registration);
})
.catch(error => {
console.log('Service Worker registration failed:', error);
});
});
}
0 - G
0