Skip to content

Instantly share code, notes, and snippets.

function requestLocation(){
if (window.Geolocation){
window.Geolocation.getCurrentPosition(function(position){
createMap(position.coors.latitude, position.coors.longitude);
})
}
else {
alert("Your current browser does not support the Geolocation feature.");
}
}
window.addEventListener("load", function(){
progressier.add({
id: "pDy0w3lGo3j9gL2zwK"
});
});
@kbstt
kbstt / server-side-dynamic-manifest-localization.js
Last active October 12, 2022 00:32
Localized PWA manifest example with node.js
app.get('/manifest.json', function(req, res){
try {
//this is our localized content
let localizedContent = {
name: {
en: "Example App",
fr: "Appli Example",
es: "Aplicación de ejemplo"
},
description: {
function currentBrowserSupportsPush(){
if (!'PushManager' in window){return false;}
 if (!'serviceWorker' in navigator){return false;}
 if (!'Notification' in window){return false;}
 return true;
 }