Skip to content

Instantly share code, notes, and snippets.

View fabiwlf's full-sized avatar
🐕
Trading

Fabian Wolf fabiwlf

🐕
Trading
  • Wiesbaden, Germany
View GitHub Profile
@fabiwlf
fabiwlf / manifestinjector.js
Created November 30, 2021 21:50
Make web.whatsapp.com and any other website with service worker but no manifest installable from browser
const makeManifest = async (manifest) => {
manifest.description = document.head.children.description?.content;
const icons = await Promise.all(Array.from(document.querySelectorAll(`link[rel$="icon"]`)).map((icon) => new Promise((resolve) => {
const img = new Image()
img.src = icon.href || icon.src;
img.onload = resolve;
img.onerror = () => resolve(null);
})));
for (let iconLoadEvent of icons) {
if (!iconLoadEvent) continue;