Skip to content

Commit

Permalink
test force install prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
wleightond committed Aug 3, 2024
1 parent 27b53a9 commit 0c1e8cc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions templates/pwa.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@
//console.log("token triggered!");
}
});

async function trigger_install() {
if (!installPrompt) {
return;
}
const result = await installPrompt.prompt();
console.log(`Install prompt was: ${result.outcome}`);
disableInAppInstallPrompt();
}

function disableInAppInstallPrompt() {
installPrompt = null;
installButton.setAttribute("hidden", "");
}

trigger_install();
</script>
<style>
html,body,main {height: 100%}
Expand All @@ -89,11 +105,17 @@
<body onpageshow="trigger_token()">
<main class="container" hidden>
<h1>Installation instructions:</h1>

<h3>For iPhones:</h3>
<ol>
<li>Click Share</li>
<li>Click Add to Home Screen</li>
<li>Click OK</li>
</ol>

<h3>For Android:</h3>
Web app installation on Android happens in a variety of ways.
<p>These instructions will disappear when you reload the page.</p>
</main>
<script>
if (!(document.cookie === 'instructions_shown=true')) {
Expand Down

0 comments on commit 0c1e8cc

Please sign in to comment.