File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,13 +93,21 @@ const initPwaInstall = () => {
9393 const pwaInstall = document . createElement ( 'pwa-install' ) ;
9494 pwaInstall . id = 'pwa-install' ;
9595
96+ // Optimization: Only use attributes that enhance the specific project experience
97+ // Use local storage to avoid showing the prompt too often
98+ pwaInstall . setAttribute ( 'use-local-storage' , '' ) ;
99+
100+ // Professional branding
101+ pwaInstall . setAttribute ( 'name' , 'Document Editor' ) ;
102+ pwaInstall . setAttribute ( 'description' , 'A privacy-focused, local web-based document editor.' ) ;
103+ pwaInstall . setAttribute ( 'install-description' , 'Install the App for a better offline experience and quick access.' ) ;
104+
96105 // Use the browser's native resolution from the existing link tags
97- // This is the most elegant and "Single Source of Truth" way
98106 const manifest = document . querySelector < HTMLLinkElement > ( 'link[rel="manifest"]' ) ;
99107 const icon = document . querySelector < HTMLLinkElement > ( 'link[rel="icon"]' ) ;
100- console . log ( manifest ?. href , icon ?. href ) ;
108+
101109 if ( manifest ?. href ) pwaInstall . setAttribute ( 'manifest-url' , manifest . href ) ;
102- if ( icon ?. href ) pwaInstall . setAttribute ( 'icon-url ' , icon . href ) ;
110+ if ( icon ?. href ) pwaInstall . setAttribute ( 'icon' , icon . href ) ;
103111
104112 document . body . appendChild ( pwaInstall ) ;
105113} ;
You can’t perform that action at this time.
0 commit comments