├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── bin └── index.js ├── demos ├── custom │ └── index.html ├── debug │ └── index.html ├── detect-homescreen │ └── index.html ├── firefox │ └── index.html ├── general │ └── index.html ├── guideance │ ├── chrome │ │ ├── android │ │ │ └── index.html │ │ └── desktop │ │ │ └── index.html │ ├── index.html │ └── iphone │ │ └── index.html ├── imgs │ ├── chromium-add2hs-modal.png │ ├── chromium-guidance.png │ ├── common-a2hs-touch-hold-mannually-modal.png │ ├── edge-a2hs-icon.png │ ├── firefox-a2hs-icon.png │ ├── firefox-a2hs-prompt.png │ ├── icon-16x16.png │ ├── icon.svg │ ├── install-pwa-chrome-menu.png │ ├── install-pwa-edge-menu.png │ ├── ios-safari-share-button-highlight.jpg │ ├── iphone-a2hs-icon-highlight.jpg │ ├── iphone-a2hs-swipe-to-right.jpg │ ├── opera-add-to-homescreen.png │ ├── pwa-logo-50x50.png │ ├── safari-ipad-share-a2hs-right.jpg │ ├── safari-ipad-share-a2hs-right.png │ └── samsung-internet-a2hs-icon.png ├── index.html ├── inline │ └── index.html ├── ipad │ └── index.html ├── iphone │ └── index.html ├── js │ ├── a2hs_prompt.js │ ├── addtohomescreen.js │ └── custom_console.js ├── manifest.json ├── meta │ ├── android │ │ ├── android-launchericon-144-144.png │ │ ├── android-launchericon-192-192.png │ │ ├── android-launchericon-48-48.,png │ │ ├── android-launchericon-48-48.png │ │ ├── android-launchericon-512-512.png │ │ ├── android-launchericon-72-72.png │ │ └── android-launchericon-96-96.png │ ├── chrome │ │ ├── chrome-extensionmanagementpage-48-48.png │ │ ├── chrome-favicon-16-16.png │ │ └── chrome-installprocess-128-128.png │ ├── firefox │ │ ├── firefox-general-128-128.png │ │ ├── firefox-general-16-16.png │ │ ├── firefox-general-256-256.png │ │ ├── firefox-general-32-32.png │ │ ├── firefox-general-48-48.png │ │ ├── firefox-general-64-64.png │ │ ├── firefox-general-90-90.png │ │ ├── firefox-marketplace-128-128.png │ │ └── firefox-marketplace-512-512.png │ ├── ios │ │ ├── ios-appicon-1024-1024.png │ │ ├── ios-appicon-120-120.png │ │ ├── ios-appicon-152-152.png │ │ ├── ios-appicon-180-180.png │ │ ├── ios-appicon-76-76.png │ │ ├── ios-launchimage-1024-768.png │ │ ├── ios-launchimage-1242-2208.png │ │ ├── ios-launchimage-1334-750.png │ │ ├── ios-launchimage-1536-2048.png │ │ ├── ios-launchimage-2048-1536.png │ │ ├── ios-launchimage-2208-1242.png │ │ ├── ios-launchimage-640-1136.png │ │ ├── ios-launchimage-640-960.png │ │ ├── ios-launchimage-750-1334.png │ │ └── ios-launchimage-768-1024.png │ ├── love2dev-144x144.png │ ├── love2dev-512x512.png │ ├── love2dev-icon-192x192.png │ ├── windows │ │ ├── windows-smallsquare-24-24.png │ │ ├── windows-smallsquare-30-30.png │ │ ├── windows-smallsquare-42-42.png │ │ ├── windows-smallsquare-54-54.png │ │ ├── windows-splashscreen-1116-540.png │ │ ├── windows-splashscreen-620-300.png │ │ ├── windows-splashscreen-868-420.png │ │ ├── windows-squarelogo-120-120.png │ │ ├── windows-squarelogo-150-150.png │ │ ├── windows-squarelogo-210-210.png │ │ ├── windows-squarelogo-270-270.png │ │ ├── windows-storelogo-50-50.png │ │ ├── windows-storelogo-70-70.png │ │ ├── windows-storelogo-90-90.png │ │ ├── windowsphone-appicon-106-106.png │ │ ├── windowsphone-appicon-44-44.png │ │ ├── windowsphone-appicon-62-62.png │ │ ├── windowsphone-mediumtile-150-150.png │ │ ├── windowsphone-mediumtile-210-210.png │ │ ├── windowsphone-mediumtile-360-360.png │ │ ├── windowsphone-smalltile-170-170.png │ │ ├── windowsphone-smalltile-71-71.png │ │ ├── windowsphone-smalltile-99-99.png │ │ ├── windowsphone-storelogo-120-120.png │ │ ├── windowsphone-storelogo-50-50.png │ │ └── windowsphone-storelogo-70-70.png │ └── windows10 │ │ ├── SplashScreen.scale-100.png │ │ ├── SplashScreen.scale-125.png │ │ ├── SplashScreen.scale-150.png │ │ ├── SplashScreen.scale-200.png │ │ ├── SplashScreen.scale-400.png │ │ ├── Square150x150Logo.scale-100.png │ │ ├── Square150x150Logo.scale-125.png │ │ ├── Square150x150Logo.scale-150.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square150x150Logo.scale-400.png │ │ ├── Square310x310Logo.scale-100.png │ │ ├── Square310x310Logo.scale-125.png │ │ ├── Square310x310Logo.scale-150.png │ │ ├── Square310x310Logo.scale-200.png │ │ ├── Square310x310Logo.scale-400.png │ │ ├── Square44x44Logo.scale-100.png │ │ ├── Square44x44Logo.scale-125.png │ │ ├── Square44x44Logo.scale-150.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.scale-400.png │ │ ├── Square44x44Logo.targetsize-16.png │ │ ├── Square44x44Logo.targetsize-16_altform-unplated.png │ │ ├── Square44x44Logo.targetsize-24.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── Square44x44Logo.targetsize-256.png │ │ ├── Square44x44Logo.targetsize-256_altform-unplated.png │ │ ├── Square44x44Logo.targetsize-48.png │ │ ├── Square44x44Logo.targetsize-48_altform-unplated.png │ │ ├── Square71x71Logo.scale-100.png │ │ ├── Square71x71Logo.scale-125.png │ │ ├── Square71x71Logo.scale-150.png │ │ ├── Square71x71Logo.scale-200.png │ │ ├── Square71x71Logo.scale-400.png │ │ ├── StoreLogo.png │ │ ├── StoreLogo.scale-100.png │ │ ├── StoreLogo.scale-125.png │ │ ├── StoreLogo.scale-150.png │ │ ├── StoreLogo.scale-200.png │ │ ├── StoreLogo.scale-400.png │ │ ├── Wide310x150Logo.scale-100.png │ │ ├── Wide310x150Logo.scale-125.png │ │ ├── Wide310x150Logo.scale-150.png │ │ ├── Wide310x150Logo.scale-200.png │ │ └── Wide310x150Logo.scale-400.png ├── offline │ └── index.html ├── opera │ └── index.html ├── samsung │ └── index.html ├── style │ ├── addtohomescreen.css │ ├── all.css │ ├── all.min.css │ ├── animate.css │ ├── animate.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ └── site.css ├── sw.js ├── trigger │ └── index.html └── webfonts │ ├── fa-brands-400.eot │ ├── fa-brands-400.svg │ ├── fa-brands-400.ttf │ ├── fa-brands-400.woff │ ├── fa-brands-400.woff2 │ ├── fa-regular-400.eot │ ├── fa-regular-400.svg │ ├── fa-regular-400.ttf │ ├── fa-regular-400.woff │ ├── fa-regular-400.woff2 │ ├── fa-solid-900.eot │ ├── fa-solid-900.svg │ ├── fa-solid-900.ttf │ ├── fa-solid-900.woff │ ├── fa-solid-900.woff2 │ ├── fontello.eot │ ├── fontello.svg │ ├── fontello.ttf │ ├── fontello.woff │ └── fontello.woff2 ├── imgs ├── action-icon-android.png ├── action-icon-ios6.png ├── action-icon-ios7.png ├── chromium-add2hs-modal.png ├── common-a2hs-touch-hold-mannually-modal.png ├── example-pwa-prompt.png ├── firefox-a2hs-icon.png ├── firefox-a2hs-prompt.png ├── icon-152x152.png ├── icon-16x16.png ├── icon-196x196.png ├── icon.svg ├── install-pwa-chrome-menu.png ├── install-pwa-edge-menu.png ├── ios-safari-share-button-highlight.jpg ├── iphone-a2hs-icon-highlight.jpg ├── iphone-a2hs-swipe-to-right.jpg ├── iphone-a2hs-swipe-to-right.png ├── opera-add-to-homescreen.png ├── safari-ipad-share-a2hs-right.png ├── safari-ipad-share-a2hs.png └── samsung-internet-a2hs-icon.png ├── package-lock.json ├── package.json ├── project.todo ├── src ├── addtohomescreen.js ├── addtohomescreen.min.js ├── desktop-ua.tsv ├── mobile-ua.tsv └── session.json ├── style ├── addtohomescreen.css ├── all.css ├── all.min.css ├── animate.css ├── animate.min.css ├── bootstrap.css ├── bootstrap.css.map ├── bootstrap.min.css └── bootstrap.min.css.map └── webfonts ├── fa-brands-400.eot ├── fa-brands-400.svg ├── fa-brands-400.ttf ├── fa-brands-400.woff ├── fa-brands-400.woff2 ├── fa-regular-400.eot ├── fa-regular-400.svg ├── fa-regular-400.ttf ├── fa-regular-400.woff ├── fa-regular-400.woff2 ├── fa-solid-900.eot ├── fa-solid-900.svg ├── fa-solid-900.ttf ├── fa-solid-900.woff ├── fa-solid-900.woff2 ├── fontello.eot ├── fontello.svg ├── fontello.ttf ├── fontello.woff └── fontello.woff2 /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | .env.test 64 | 65 | # parcel-bundler cache (https://parceljs.org/) 66 | .cache 67 | 68 | # next.js build output 69 | .next 70 | 71 | # nuxt.js build output 72 | .nuxt 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless/ 79 | 80 | # FuseBox cache 81 | .fusebox/ 82 | 83 | # DynamoDB Local files 84 | .dynamodb/ -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}\\bin\\index.js" 15 | }, 16 | { 17 | "type": "node", 18 | "request": "launch", 19 | "name": "Debug Current File in its Directory", 20 | "program": "${file}", 21 | "cwd": "${fileDirname}" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Copyright (c) 2014-2016 Matteo Spinelli 4 | 5 | Copyright (c) 2019-2022 Chris Love 6 | 7 | Version 2.0, January 2004 8 | http://www.apache.org/licenses/ 9 | 10 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 11 | 12 | 1. Definitions. 13 | 14 | "License" shall mean the terms and conditions for use, reproduction, 15 | and distribution as defined by Sections 1 through 9 of this document. 16 | 17 | "Licensor" shall mean the copyright owner or entity authorized by 18 | the copyright owner that is granting the License. 19 | 20 | "Legal Entity" shall mean the union of the acting entity and all 21 | other entities that control, are controlled by, or are under common 22 | control with that entity. For the purposes of this definition, 23 | "control" means (i) the power, direct or indirect, to cause the 24 | direction or management of such entity, whether by contract or 25 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 26 | outstanding shares, or (iii) beneficial ownership of such entity. 27 | 28 | "You" (or "Your") shall mean an individual or Legal Entity 29 | exercising permissions granted by this License. 30 | 31 | "Source" form shall mean the preferred form for making modifications, 32 | including but not limited to software source code, documentation 33 | source, and configuration files. 34 | 35 | "Object" form shall mean any form resulting from mechanical 36 | transformation or translation of a Source form, including but 37 | not limited to compiled object code, generated documentation, 38 | and conversions to other media types. 39 | 40 | "Work" shall mean the work of authorship, whether in Source or 41 | Object form, made available under the License, as indicated by a 42 | copyright notice that is included in or attached to the work 43 | (an example is provided in the Appendix below). 44 | 45 | "Derivative Works" shall mean any work, whether in Source or Object 46 | form, that is based on (or derived from) the Work and for which the 47 | editorial revisions, annotations, elaborations, or other modifications 48 | represent, as a whole, an original work of authorship. For the purposes 49 | of this License, Derivative Works shall not include works that remain 50 | separable from, or merely link (or bind by name) to the interfaces of, 51 | the Work and Derivative Works thereof. 52 | 53 | "Contribution" shall mean any work of authorship, including 54 | the original version of the Work and any modifications or additions 55 | to that Work or Derivative Works thereof, that is intentionally 56 | submitted to Licensor for inclusion in the Work by the copyright owner 57 | or by an individual or Legal Entity authorized to submit on behalf of 58 | the copyright owner. For the purposes of this definition, "submitted" 59 | means any form of electronic, verbal, or written communication sent 60 | to the Licensor or its representatives, including but not limited to 61 | communication on electronic mailing lists, source code control systems, 62 | and issue tracking systems that are managed by, or on behalf of, the 63 | Licensor for the purpose of discussing and improving the Work, but 64 | excluding communication that is conspicuously marked or otherwise 65 | designated in writing by the copyright owner as "Not a Contribution." 66 | 67 | "Contributor" shall mean Licensor and any individual or Legal Entity 68 | on behalf of whom a Contribution has been received by Licensor and 69 | subsequently incorporated within the Work. 70 | 71 | 2. Grant of Copyright License. Subject to the terms and conditions of 72 | this License, each Contributor hereby grants to You a perpetual, 73 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 74 | copyright license to reproduce, prepare Derivative Works of, 75 | publicly display, publicly perform, sublicense, and distribute the 76 | Work and such Derivative Works in Source or Object form. 77 | 78 | 3. Grant of Patent License. Subject to the terms and conditions of 79 | this License, each Contributor hereby grants to You a perpetual, 80 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 81 | (except as stated in this section) patent license to make, have made, 82 | use, offer to sell, sell, import, and otherwise transfer the Work, 83 | where such license applies only to those patent claims licensable 84 | by such Contributor that are necessarily infringed by their 85 | Contribution(s) alone or by combination of their Contribution(s) 86 | with the Work to which such Contribution(s) was submitted. If You 87 | institute patent litigation against any entity (including a 88 | cross-claim or counterclaim in a lawsuit) alleging that the Work 89 | or a Contribution incorporated within the Work constitutes direct 90 | or contributory patent infringement, then any patent licenses 91 | granted to You under this License for that Work shall terminate 92 | as of the date such litigation is filed. 93 | 94 | 4. Redistribution. You may reproduce and distribute copies of the 95 | Work or Derivative Works thereof in any medium, with or without 96 | modifications, and in Source or Object form, provided that You 97 | meet the following conditions: 98 | 99 | (a) You must give any other recipients of the Work or 100 | Derivative Works a copy of this License; and 101 | 102 | (b) You must cause any modified files to carry prominent notices 103 | stating that You changed the files; and 104 | 105 | (c) You must retain, in the Source form of any Derivative Works 106 | that You distribute, all copyright, patent, trademark, and 107 | attribution notices from the Source form of the Work, 108 | excluding those notices that do not pertain to any part of 109 | the Derivative Works; and 110 | 111 | (d) If the Work includes a "NOTICE" text file as part of its 112 | distribution, then any Derivative Works that You distribute must 113 | include a readable copy of the attribution notices contained 114 | within such NOTICE file, excluding those notices that do not 115 | pertain to any part of the Derivative Works, in at least one 116 | of the following places: within a NOTICE text file distributed 117 | as part of the Derivative Works; within the Source form or 118 | documentation, if provided along with the Derivative Works; or, 119 | within a display generated by the Derivative Works, if and 120 | wherever such third-party notices normally appear. The contents 121 | of the NOTICE file are for informational purposes only and 122 | do not modify the License. You may add Your own attribution 123 | notices within Derivative Works that You distribute, alongside 124 | or as an addendum to the NOTICE text from the Work, provided 125 | that such additional attribution notices cannot be construed 126 | as modifying the License. 127 | 128 | You may add Your own copyright statement to Your modifications and 129 | may provide additional or different license terms and conditions 130 | for use, reproduction, or distribution of Your modifications, or 131 | for any such Derivative Works as a whole, provided Your use, 132 | reproduction, and distribution of the Work otherwise complies with 133 | the conditions stated in this License. 134 | 135 | 5. Submission of Contributions. Unless You explicitly state otherwise, 136 | any Contribution intentionally submitted for inclusion in the Work 137 | by You to the Licensor shall be under the terms and conditions of 138 | this License, without any additional terms or conditions. 139 | Notwithstanding the above, nothing herein shall supersede or modify 140 | the terms of any separate license agreement you may have executed 141 | with Licensor regarding such Contributions. 142 | 143 | 6. Trademarks. This License does not grant permission to use the trade 144 | names, trademarks, service marks, or product names of the Licensor, 145 | except as required for reasonable and customary use in describing the 146 | origin of the Work and reproducing the content of the NOTICE file. 147 | 148 | 7. Disclaimer of Warranty. Unless required by applicable law or 149 | agreed to in writing, Licensor provides the Work (and each 150 | Contributor provides its Contributions) on an "AS IS" BASIS, 151 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 152 | implied, including, without limitation, any warranties or conditions 153 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 154 | PARTICULAR PURPOSE. You are solely responsible for determining the 155 | appropriateness of using or redistributing the Work and assume any 156 | risks associated with Your exercise of permissions under this License. 157 | 158 | 8. Limitation of Liability. In no event and under no legal theory, 159 | whether in tort (including negligence), contract, or otherwise, 160 | unless required by applicable law (such as deliberate and grossly 161 | negligent acts) or agreed to in writing, shall any Contributor be 162 | liable to You for damages, including any direct, indirect, special, 163 | incidental, or consequential damages of any character arising as a 164 | result of this License or out of the use or inability to use the 165 | Work (including but not limited to damages for loss of goodwill, 166 | work stoppage, computer failure or malfunction, or any and all 167 | other commercial damages or losses), even if such Contributor 168 | has been advised of the possibility of such damages. 169 | 170 | 9. Accepting Warranty or Additional Liability. While redistributing 171 | the Work or Derivative Works thereof, You may choose to offer, 172 | and charge a fee for, acceptance of support, warranty, indemnity, 173 | or other liability obligations and/or rights consistent with this 174 | License. However, in accepting such obligations, You may act only 175 | on Your own behalf and on Your sole responsibility, not on behalf 176 | of any other Contributor, and only if You agree to indemnify, 177 | defend, and hold each Contributor harmless for any liability 178 | incurred by, or claims asserted against, such Contributor by reason 179 | of your accepting any such warranty or additional liability. 180 | 181 | END OF TERMS AND CONDITIONS 182 | 183 | APPENDIX: How to apply the Apache License to your work. 184 | 185 | To apply the Apache License to your work, attach the following 186 | boilerplate notice, with the fields enclosed by brackets "{}" 187 | replaced with your own identifying information. (Don't include 188 | the brackets!) The text should be enclosed in the appropriate 189 | comment syntax for the file format. We also recommend that a 190 | file or class name and description of purpose be included on the 191 | same "printed page" as the copyright notice for easier 192 | identification within third-party archives. 193 | 194 | Copyright {yyyy} {name of copyright owner} 195 | 196 | Licensed under the Apache License, Version 2.0 (the "License"); 197 | you may not use this file except in compliance with the License. 198 | You may obtain a copy of the License at 199 | 200 | http://www.apache.org/licenses/LICENSE-2.0 201 | 202 | Unless required by applicable law or agreed to in writing, software 203 | distributed under the License is distributed on an "AS IS" BASIS, 204 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 205 | See the License for the specific language governing permissions and 206 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Add to Homescreen call out 2 | 3 | Script for mobile devices, it automatically shows an overlaying message encouraging to add the web app to the homescreen. Compatible with iOS 6+ and Chrome for Android (soon WinPhone). 4 | 5 | ## Installation 6 | 7 | Add `addtohomescreen.css` and `addtohomescreen.js` to the head of your projects index file. Then, call `addToHomescreen();` as soon as possible. For example: 8 | 9 | ```html 10 | 11 | Add To Home 12 | ... 13 | 14 | 15 | 20 | 21 | ``` 22 | 23 | ## Options 24 | 25 | There are multiple properties used to determine if the prompt can be displayed. They are created so you can control when the prompt is diplayed, mostly based on number of page views (sessions) and time. 26 | 27 | You can use the customCriteria property to set your own value. The library checks to see if this property is true (default) or false. If the value is true it will use the other rules accordingly. 28 | 29 | You can set this property either to a boolean (true|false) or a custom function that will execute your own logic. 30 | 31 | A good example for this is when determining if a user is authenticated first. Your custom method can check your authentication token for validity. 32 | 33 | Note: you can define rules for each page in your site as they may change from page to page. For example you would not want to distract a customer from paying for an order or when they are creating an account. 34 | 35 | * **mandatory**: you can't proceed if you don't add the app to the homescreen 36 | * **autostart**: show the message automatically 37 | * **skipFirstVisit**: show only to returning visitors (ie: skip the first time you visit) 38 | * **minSessions**: show only after minimum number of page views 39 | * **startDelay**: display the message after that many seconds from page load 40 | * **lifespan**: life of the message in seconds 41 | * **displayPace**: 1440, minutes before the message is shown again (0: display every time, default 24 hours) 42 | * **displayNextPrime**: A fun 'algorithm' I added to trigger the prompt based on page views that are prime numbers 43 | * **customCriteria**: A hook for you to provide either a custom method or a simple true|false value to control when it prompts 44 | 45 | ### Hooking into the Event Pipeline 46 | 47 | You can hook into the event pipeline to trigger your own callback methods. This can be usefule when debugging issues with your logic or possibly triggering other activities in your user experience or possibly logging activity to your analytics service. 48 | 49 | ```javascript 50 | var ath = addToHomescreen( { 51 | onShow: function () { 52 | console.log( "showing" ); 53 | }, 54 | onInit: function () { 55 | console.log( "initializing" ); 56 | }, 57 | onAdd: function () { 58 | console.log( "adding" ); 59 | }, 60 | onInstall: function () { 61 | console.log( "Installing" ); 62 | }, 63 | onCancel: function () { 64 | console.log( "Cancelling" ); 65 | } 66 | } ); 67 | ``` 68 | 69 | ### Customizing the Prompt 70 | 71 | These are the properties you can set to define the CSS selectors and classes used to drive the prompt banner. 72 | 73 | The PrompDlg properties are used to define targets for resources to be set or injected by the library at runtime. 74 | 75 | The action properties for ok and cancel correspond to the buttons on the prompt. This is the text you want used. 76 | 77 | ```javascript 78 | athWrapper: ".ath-container", 79 | athGuidance: "ath-guidance", 80 | showClasses: [ "animated", "d-flex" ], 81 | showClass: "d-flex", 82 | hideClass: "d-none", 83 | promptDlg: { 84 | title: ".ath-banner-title", 85 | body: ".ath-banner", 86 | logo: ".ath-prompt-logo", 87 | cancel: ".btn-cancel", 88 | install: ".btn-install", 89 | action: { 90 | "ok": "Install", 91 | "cancel": "Not Now" 92 | } 93 | ``` 94 | 95 | 96 | 97 | For more, consult the [blog post](https://love2dev.com/pwa/add-to-homescreen-library/). 98 | 99 | ## License 100 | 101 | Copyright (c) 2014 Matteo Spinelli, http://cubiq.org/ 102 | Copyright (c) 2019 Chris Love, http://love2dev.com/ 103 | 104 | Permission is hereby granted, free of charge, to any person 105 | obtaining a copy of this software and associated documentation 106 | files (the "Software"), to deal in the Software without 107 | restriction, including without limitation the rights to use, 108 | copy, modify, merge, publish, distribute, sublicense, and/or sell 109 | copies of the Software, and to permit persons to whom the 110 | Software is furnished to do so, subject to the following 111 | conditions: 112 | 113 | The above copyright notice and this permission notice shall be 114 | included in all copies or substantial portions of the Software. 115 | 116 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 117 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 118 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 119 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 120 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 121 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 122 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 123 | OTHER DEALINGS IN THE SOFTWARE. 124 | -------------------------------------------------------------------------------- /bin/index.js: -------------------------------------------------------------------------------- 1 | const UglifyJS = require( "uglify-es" ), 2 | path = require( "path" ), 3 | fs = require( "fs" ); 4 | 5 | let utf8 = "utf8"; 6 | 7 | function uglifyScript() { 8 | 9 | return new Promise( ( resolve, reject ) => { 10 | 11 | let script = fs.readFileSync( "../src/addtohomescreen.js", utf8 ); 12 | let min = new UglifyJS.minify( script, {} ); 13 | 14 | if ( min.error ) { 15 | reject( min.error ); 16 | } else { 17 | 18 | if ( min.code && min.code !== "" ) { 19 | 20 | fs.writeFileSync( "../src/addtohomescreen.min.js", min.code, utf8 ); 21 | 22 | resolve(); 23 | 24 | } 25 | 26 | } 27 | 28 | } ); 29 | 30 | } 31 | 32 | uglifyScript(); -------------------------------------------------------------------------------- /demos/custom/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Uses a simple random number generator to determine if the prompt can be triggered.

33 |

This allows the site owner/manager to determine if there are application specific criteria that must be 34 | met 35 | before the user can be prompted to add to homescreen. For example the user must be authenticated or meet 36 | a 37 | certain score or threshold.

38 |


39 |
40 |
41 | 57 | 58 | 59 | 60 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /demos/debug/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

General debug testing

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 42 | 43 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /demos/detect-homescreen/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 |

This demo tries to detect when the application is added to the homescreen by using a #hash token. You can also 25 | use a query string or a smart URL, but they are all guesstimate and there's a 20-30% chances of false positives. 26 | The good news is that false negative (ie: the call out being displayed when the app has been already added to 27 | the homescreen) should be very rare.

28 |

Remember that the only 100% safe way to use the add to homescreen feature is by using the 29 | apple-mobile-web-app-capable meta tag.

30 | 31 | 32 | -------------------------------------------------------------------------------- /demos/firefox/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Uses the debug option, set to 'firefox', to help test the FireFox Browser experience.

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 60 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /demos/general/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Basic testing page.

33 |
34 | 35 |
36 |
37 |
38 |
39 | 40 |
41 | 57 | 58 | 59 | 60 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /demos/guideance/chrome/android/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home - Link to Guideance Pages 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Use the native prompt - Android

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /demos/guideance/chrome/desktop/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home - Link to Guideance Pages 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Use the native prompt - desktop

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 60 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /demos/guideance/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home - Link to Guideance Pages 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Uses the debug option, set to 'iphone', to help test the iPhone experience.

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /demos/guideance/iphone/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home - Link to Guideance Pages 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Use the Share button and then add to homescreen

33 |
34 |
35 |
36 |
37 | 53 | 54 | 55 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /demos/imgs/chromium-add2hs-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/chromium-add2hs-modal.png -------------------------------------------------------------------------------- /demos/imgs/chromium-guidance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/chromium-guidance.png -------------------------------------------------------------------------------- /demos/imgs/common-a2hs-touch-hold-mannually-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/common-a2hs-touch-hold-mannually-modal.png -------------------------------------------------------------------------------- /demos/imgs/edge-a2hs-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/edge-a2hs-icon.png -------------------------------------------------------------------------------- /demos/imgs/firefox-a2hs-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/firefox-a2hs-icon.png -------------------------------------------------------------------------------- /demos/imgs/firefox-a2hs-prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/firefox-a2hs-prompt.png -------------------------------------------------------------------------------- /demos/imgs/icon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/icon-16x16.png -------------------------------------------------------------------------------- /demos/imgs/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 28 | 32 | 36 | 37 | 40 | 44 | 48 | 49 | 52 | 56 | 60 | 61 | 71 | 81 | 91 | 92 | 114 | 116 | 117 | 119 | image/svg+xml 120 | 122 | 123 | 124 | 125 | 126 | 131 | 140 | 148 | 154 | 160 | 166 | 172 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /demos/imgs/install-pwa-chrome-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/install-pwa-chrome-menu.png -------------------------------------------------------------------------------- /demos/imgs/install-pwa-edge-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/install-pwa-edge-menu.png -------------------------------------------------------------------------------- /demos/imgs/ios-safari-share-button-highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/ios-safari-share-button-highlight.jpg -------------------------------------------------------------------------------- /demos/imgs/iphone-a2hs-icon-highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/iphone-a2hs-icon-highlight.jpg -------------------------------------------------------------------------------- /demos/imgs/iphone-a2hs-swipe-to-right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/iphone-a2hs-swipe-to-right.jpg -------------------------------------------------------------------------------- /demos/imgs/opera-add-to-homescreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/opera-add-to-homescreen.png -------------------------------------------------------------------------------- /demos/imgs/pwa-logo-50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/pwa-logo-50x50.png -------------------------------------------------------------------------------- /demos/imgs/safari-ipad-share-a2hs-right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/safari-ipad-share-a2hs-right.jpg -------------------------------------------------------------------------------- /demos/imgs/safari-ipad-share-a2hs-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/safari-ipad-share-a2hs-right.png -------------------------------------------------------------------------------- /demos/imgs/samsung-internet-a2hs-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/imgs/samsung-internet-a2hs-icon.png -------------------------------------------------------------------------------- /demos/inline/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Install Progressive Web App - Inline Content Demonstration 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |


33 |

Inline testing page. v0.0.1

34 | 50 | 51 | 52 |
53 | 54 |
55 |
56 |
57 |
58 | 59 |
60 | 61 | 62 | 63 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /demos/ipad/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Uses the debug option, set to 'ipad', to help test the iPad experience.

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 60 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /demos/iphone/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |


32 |

Uses the debug option, set to 'iphone', to help test the iPhone experience.

33 |
34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 | 57 | 58 | 59 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /demos/js/addtohomescreen.js: -------------------------------------------------------------------------------- 1 | /* Add to Homescreen v4.0.0 ~ (c) 2019 Chris Love ~ @license: https://love2dev.com/pwa/add-to-homescreen/ */ 2 | /* 3 | Check out these PWA Resources: 4 | 5 | https://love2dev.com/pwa/pwa-starter/ 6 | https://pwastarter.love2dev.com/ 7 | https://love2dev.com/blog/beforeinstallprompt/ 8 | 9 | */ 10 | 11 | /* 12 | _ _ _____ _____ 13 | ___ _| |_| |_ _|___| | |___ _____ ___ ___ ___ ___ ___ ___ ___ 14 | | .'| . | . | | | | . | | . | | -_|_ -| _| _| -_| -_| | 15 | |__,|___|___| |_| |___|__|__|___|_|_|_|___|___|___|_| |___|___|_|_| 16 | by Matteo Spinelli ~ http://cubiq.org <-- No longer there :< 17 | Upgraded for PWA Support by Chris Love ~ https://love2dev.com/ 18 | USE PWA Starter to scaffold your core PWA files ~ https://pwastarter.love2dev.com/ 19 | */ 20 | 21 | (function(window, document, undefined) { 22 | "use strict"; 23 | 24 | // load session 25 | var _instance, 26 | _default = { 27 | getSesssion: getSesssion, 28 | updateSessionProperty: updateSessionProperty, 29 | updateSession: updateSession, 30 | clearSession: clearSession, 31 | optOut: optOut, 32 | optIn: optIn, 33 | displayed: displayed, 34 | clearDisplayCount: clearDisplayCount, 35 | version: "2.0.0" 36 | }, 37 | SESSION_KEY = "a2hs-state"; 38 | 39 | var platform = { 40 | isCompatible: false, 41 | nativePrompt: "onbeforeinstallprompt" in window 42 | }; 43 | 44 | if ("onbeforeinstallprompt" in window) { 45 | window.addEventListener("beforeinstallprompt", beforeInstallPrompt); 46 | } 47 | 48 | function writeLog(logStr) { 49 | if (_instance.logging) { 50 | if (_instance.logger) { 51 | _instance.logger.log(logStr); 52 | } else { 53 | console.log(logStr); 54 | } 55 | } 56 | } 57 | 58 | function ath(settings) { 59 | //prevent duplicate instances 60 | if (!_instance) { 61 | _instance = Object.assign({}, _default, settings); 62 | 63 | // override defaults that are dependent on each other 64 | if (_instance.debug && typeof _instance.logging === "undefined") { 65 | _instance.logging = true; 66 | } 67 | 68 | //if no service worker then no add to homescreen 69 | if ("serviceWorker" in navigator) { 70 | var manifestEle = document.querySelector("[rel='manifest']"); 71 | 72 | //if no manifest file then no add to homescreen 73 | if (!manifestEle) { 74 | writeLog("no manifest file"); 75 | writeLog( 76 | "Add to homescreen: not displaying callout because no web manifest file present" 77 | ); 78 | } else { 79 | navigator.serviceWorker.getRegistration().then(afterSWCheck); 80 | } 81 | } else { 82 | writeLog("service worker not supported"); 83 | writeLog( 84 | "Add to homescreen: not displaying callout because service workers are not supported" 85 | ); 86 | } 87 | } 88 | 89 | return _instance; 90 | } 91 | 92 | if ("onappinstalled" in window) { 93 | window.addEventListener("appinstalled", function(evt) { 94 | writeLog("a2hs", "installed"); 95 | 96 | if (_instance.onInstall) { 97 | _instance.onInstall(evt); 98 | } 99 | }); 100 | } 101 | 102 | function afterSWCheck(sw) { 103 | if (!sw) { 104 | writeLog("no service worker"); 105 | platform.isCompatible = false; 106 | //return, no need to go further 107 | return; 108 | } 109 | 110 | checkPlatform(); 111 | 112 | // setup the debug environment 113 | if (_instance.debug) { 114 | platform.isCompatible = true; 115 | } 116 | 117 | if (platform.isCompatible && _instance.onCanInstall) { 118 | _instance.onCanInstall(platform, _instance); 119 | } 120 | } 121 | 122 | function checkPlatform() { 123 | // browser info and capability 124 | var _ua = window.navigator.userAgent; 125 | 126 | platform.isIDevice = /iphone|ipod|ipad/i.test(navigator.platform); 127 | platform.isSamsung = /Samsung/i.test(_ua); 128 | platform.isFireFox = /Firefox/i.test(_ua); 129 | platform.isOpera = /opr/i.test(_ua); 130 | platform.isEdge = /edg/i.test(_ua); 131 | 132 | // Opera & FireFox only Trigger on Android 133 | if (platform.isFireFox) { 134 | platform.isFireFox = /android/i.test(_ua); 135 | } 136 | 137 | if (platform.isOpera) { 138 | platform.isOpera = /android/i.test(_ua); 139 | } 140 | 141 | platform.isChromium = "onbeforeinstallprompt" in window; 142 | platform.isInWebAppiOS = window.navigator.standalone === true; 143 | platform.isInWebAppChrome = 144 | window.matchMedia("(display-mode: fullscreen)").matches || 145 | window.matchMedia("(display-mode: standalone)").matches || 146 | window.matchMedia("(display-mode: minimal-ui)").matches; 147 | platform.isMobileSafari = 148 | platform.isIDevice && 149 | _ua.indexOf("Safari") > -1 && 150 | _ua.indexOf("CriOS") < 0; 151 | platform.isStandalone = platform.isInWebAppiOS || platform.isInWebAppChrome; 152 | platform.isiPad = platform.isMobileSafari && _ua.indexOf("iPad") > -1; 153 | platform.isiPhone = platform.isMobileSafari && _ua.indexOf("iPad") === -1; 154 | platform.isCompatible = 155 | platform.isChromium || 156 | platform.isMobileSafari || 157 | platform.isSamsung || 158 | platform.isFireFox || 159 | platform.isOpera || 160 | platform.isIDevice; 161 | } 162 | 163 | function beforeInstallPrompt(evt) { 164 | evt.preventDefault(); 165 | 166 | console.log("capturing the native A2HS prompt"); 167 | 168 | platform.beforeInstallPrompt = evt; 169 | 170 | if (_instance.onBeforeInstallPrompt) { 171 | _instance.onBeforeInstallPrompt(platform); 172 | } 173 | } 174 | 175 | //session members 176 | function getSesssion() { 177 | return JSON.parse(localStorage.getItem(SESSION_KEY)) || _defaultSession; 178 | } 179 | 180 | function updateSessionProperty(prop, value) { 181 | var session = getSesssion(); 182 | 183 | session[prop] = value; 184 | 185 | updateSession(session); 186 | } 187 | 188 | function updateSession(session) { 189 | localStorage.setItem(SESSION_KEY, JSON.stringify(session)); 190 | } 191 | 192 | function clearSession() { 193 | session = _defaultSession; 194 | updateSession(); 195 | } 196 | 197 | function optOut() { 198 | updateSessionProperty("optedout", true); 199 | } 200 | 201 | function optIn() { 202 | updateSessionProperty("optedout", false); 203 | } 204 | 205 | function displayed() { 206 | var session = getSesssion(); 207 | 208 | session.displayCount += 1; 209 | 210 | updateSessionProperty("displayCount", session.displayCount); 211 | } 212 | 213 | function clearDisplayCount() { 214 | updateSessionProperty("displayCount", 0); 215 | } 216 | 217 | // expose to the world 218 | window.addToHomescreen = ath; 219 | })(window, document); 220 | -------------------------------------------------------------------------------- /demos/js/custom_console.js: -------------------------------------------------------------------------------- 1 | //========================================================== 2 | // CUSTOM JAVASCRIPT CONSOLE 3 | // built by jakub fiala 4 | // 5 | // this small script intercepts the standard console methods 6 | // and provides a way of accessing their messages, 7 | // as well as stack traces, which is really cool. 8 | // it formats the stack traces for popular browsers 9 | // 10 | // contributions welcome! 11 | //========================================================== 12 | 13 | 14 | //taken from http://stackoverflow.com/a/21350614 15 | //modified to get rid of the unused add variable 16 | function str_splice( str, index, endIndex ) { 17 | return str.slice( 0, index ) + str.slice( endIndex ); 18 | } 19 | 20 | //taken from http://stackoverflow.com/a/7123542 21 | //modified to make spans rather than anchors 22 | if ( !String.linkify ) { 23 | 24 | String.prototype.linkify = function () { 25 | 26 | // http://, https://, ftp:// 27 | var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim; 28 | 29 | // www. sans http:// or https:// 30 | var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim; 31 | 32 | // Email addresses 33 | var emailAddressPattern = /[\w.]+@[a-zA-Z_-]+?(?:\.[a-zA-Z]{2,6})+/gim; 34 | 35 | return this 36 | .replace( urlPattern, '$&' ) 37 | .replace( pseudoUrlPattern, '$1$2' ) 38 | .replace( emailAddressPattern, '$&' ); 39 | }; 40 | } 41 | 42 | var is_safari = navigator.userAgent.indexOf( "Safari" ) > -1; 43 | 44 | function stack_trace_format( stackTrace ) { 45 | 46 | // if ( is_safari ) { 47 | 48 | //this seems to kind of work for both 49 | //turn spaces into list elmt boundaries, linkify, and replace at signs with html entities, just for the lulz 50 | stackTrace = '
  • ' + stackTrace.replace( /\s/gm, '
  • ' ).linkify().replace( /\@/gm, '@' ); 51 | 52 | //again, look for the first part of the trace (which is this method, we don't want that) 53 | for ( var i = 0; i < stackTrace.length; i++ ) { 54 | if ( stackTrace[ i ] == '<' && stackTrace[ i + 1 ] == '/' && stackTrace[ i + 2 ] == 'l' ) { 55 | var index = i; 56 | //found end of this part, remove it 57 | stackTrace = str_splice( stackTrace, 0, index ); 58 | 59 | break; 60 | } 61 | } 62 | 63 | // } 64 | 65 | return stackTrace; 66 | } 67 | 68 | //this is where everything happens 69 | //basic code taken from http://tobyho.com/2012/07/27/taking-over-console-log/ 70 | ( function custom_console_with_traces() { 71 | 72 | var console = window.console; 73 | 74 | if ( !console ) { 75 | alert( "console not supported :(" ); 76 | return; 77 | } 78 | 79 | function intercept( method ) { 80 | 81 | var original = console[ method ]; 82 | 83 | console[ method ] = function () { 84 | 85 | var message = Array.prototype.slice.apply( arguments ).join( ' ' ); 86 | 87 | //create an Error and get its stack trace and format it 88 | // var stackTrace = stack_trace_format( new Error().stack ); 89 | 90 | //========================================================== 91 | //do whatever you want with the stack trace and message here 92 | //========================================================== 93 | 94 | 95 | var target = document.querySelector( ".log-target" ); 96 | 97 | if ( target ) { 98 | target.innerText += "\r\n" + message; 99 | } 100 | 101 | //========================================================== 102 | //make sure we still call the original method 103 | original.call( console, message ); 104 | }; 105 | 106 | } 107 | //intercept all methods including trace 108 | var methods = [ 'log', 'warn', 'error', 'trace' ]; 109 | 110 | for ( var i = 0; i < methods.length; i++ ) { 111 | intercept( methods[ i ] ); 112 | } 113 | 114 | } )(); -------------------------------------------------------------------------------- /demos/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Add to Homescree", 3 | "short_name": "A2HS", 4 | "icons": [ { 5 | "src": "meta/windows10/Square71x71Logo.scale-400.png", 6 | "sizes": "284x284" 7 | }, 8 | { 9 | "src": "meta/windows10/Square71x71Logo.scale-200.png", 10 | "sizes": "142x142" 11 | }, 12 | { 13 | "src": "meta/windows10/Square71x71Logo.scale-100.png", 14 | "sizes": "71x71" 15 | }, 16 | { 17 | "src": "meta/windows10/Square71x71Logo.scale-150.png", 18 | "sizes": "107x107" 19 | }, 20 | { 21 | "src": "meta/windows10/Square71x71Logo.scale-125.png", 22 | "sizes": "89x89" 23 | }, 24 | { 25 | "src": "meta/windows10/Square150x150Logo.scale-400.png", 26 | "sizes": "600x600" 27 | }, 28 | { 29 | "src": "meta/windows10/Square150x150Logo.scale-200.png", 30 | "sizes": "300x300" 31 | }, 32 | { 33 | "src": "meta/windows10/Square150x150Logo.scale-100.png", 34 | "sizes": "150x150" 35 | }, 36 | { 37 | "src": "meta/windows10/Square150x150Logo.scale-150.png", 38 | "sizes": "225x225" 39 | }, 40 | { 41 | "src": "meta/windows10/Square150x150Logo.scale-125.png", 42 | "sizes": "188x188" 43 | }, 44 | { 45 | "src": "meta/windows10/Square310x310Logo.scale-400.png", 46 | "sizes": "1240x1240" 47 | }, 48 | { 49 | "src": "meta/windows10/Square310x310Logo.scale-200.png", 50 | "sizes": "620x620" 51 | }, 52 | { 53 | "src": "meta/windows10/Square310x310Logo.scale-100.png", 54 | "sizes": "310x310" 55 | }, 56 | { 57 | "src": "meta/windows10/Square310x310Logo.scale-150.png", 58 | "sizes": "465x465" 59 | }, 60 | { 61 | "src": "meta/windows10/Square310x310Logo.scale-125.png", 62 | "sizes": "388x388" 63 | }, 64 | { 65 | "src": "meta/windows10/Square44x44Logo.scale-400.png", 66 | "sizes": "176x176" 67 | }, 68 | { 69 | "src": "meta/windows10/Square44x44Logo.scale-200.png", 70 | "sizes": "88x88" 71 | }, 72 | { 73 | "src": "meta/windows10/Square44x44Logo.scale-100.png", 74 | "sizes": "44x44" 75 | }, 76 | { 77 | "src": "meta/windows10/Square44x44Logo.scale-150.png", 78 | "sizes": "66x66" 79 | }, 80 | { 81 | "src": "meta/windows10/Square44x44Logo.scale-125.png", 82 | "sizes": "55x55" 83 | }, 84 | { 85 | "src": "meta/windows10/Square44x44Logo.targetsize-256.png", 86 | "sizes": "256x256" 87 | }, 88 | { 89 | "src": "meta/windows10/Square44x44Logo.targetsize-48.png", 90 | "sizes": "48x48" 91 | }, 92 | { 93 | "src": "meta/windows10/Square44x44Logo.targetsize-24.png", 94 | "sizes": "24x24" 95 | }, 96 | { 97 | "src": "meta/windows10/Square44x44Logo.targetsize-16.png", 98 | "sizes": "16x16" 99 | }, 100 | { 101 | "src": "meta/windows10/Square44x44Logo.targetsize-256_altform-unplated.png", 102 | "sizes": "256x256" 103 | }, 104 | { 105 | "src": "meta/windows10/Square44x44Logo.targetsize-48_altform-unplated.png", 106 | "sizes": "48x48" 107 | }, 108 | { 109 | "src": "meta/windows10/Square44x44Logo.targetsize-24_altform-unplated.png", 110 | "sizes": "24x24" 111 | }, 112 | { 113 | "src": "meta/windows10/Square44x44Logo.targetsize-16_altform-unplated.png", 114 | "sizes": "16x16" 115 | }, 116 | { 117 | "src": "meta/windows10/StoreLogo.scale-400.png", 118 | "sizes": "200x200" 119 | }, 120 | { 121 | "src": "meta/windows10/StoreLogo.scale-200.png", 122 | "sizes": "100x100" 123 | }, 124 | { 125 | "src": "meta/windows10/StoreLogo.scale-150.png", 126 | "sizes": "75x75" 127 | }, 128 | { 129 | "src": "meta/windows10/StoreLogo.scale-125.png", 130 | "sizes": "63x63" 131 | }, 132 | { 133 | "src": "meta/windows10/StoreLogo.scale-100.png", 134 | "sizes": "50x50" 135 | }, 136 | { 137 | "src": "meta/windows10/StoreLogo.png", 138 | "sizes": "50x50" 139 | }, 140 | { 141 | "src": "meta/windows/windows-smallsquare-24-24.png", 142 | "sizes": "24x24" 143 | }, 144 | { 145 | "src": "meta/windows/windows-smallsquare-30-30.png", 146 | "sizes": "30x30" 147 | }, 148 | { 149 | "src": "meta/windows/windows-smallsquare-42-42.png", 150 | "sizes": "42x42" 151 | }, 152 | { 153 | "src": "meta/windows/windows-smallsquare-54-54.png", 154 | "sizes": "54x54" 155 | }, 156 | { 157 | "src": "meta/windows/windows-squarelogo-270-270.png", 158 | "sizes": "270x270" 159 | }, 160 | { 161 | "src": "meta/windows/windows-squarelogo-210-210.png", 162 | "sizes": "210x210" 163 | }, 164 | { 165 | "src": "meta/windows/windows-squarelogo-150-150.png", 166 | "sizes": "150x150" 167 | }, 168 | { 169 | "src": "meta/windows/windows-squarelogo-120-120.png", 170 | "sizes": "120x120" 171 | }, 172 | { 173 | "src": "meta/windows/windows-storelogo-90-90.png", 174 | "sizes": "90x90" 175 | }, 176 | { 177 | "src": "meta/windows/windows-storelogo-70-70.png", 178 | "sizes": "70x70" 179 | }, 180 | { 181 | "src": "meta/windows/windows-storelogo-50-50.png", 182 | "sizes": "50x50" 183 | }, 184 | { 185 | "src": "meta/windows/windowsphone-appicon-106-106.png", 186 | "sizes": "106x106" 187 | }, 188 | { 189 | "src": "meta/windows/windowsphone-appicon-62-62.png", 190 | "sizes": "62x62" 191 | }, 192 | { 193 | "src": "meta/windows/windowsphone-appicon-44-44.png", 194 | "sizes": "44x44" 195 | }, 196 | { 197 | "src": "meta/windows/windowsphone-mediumtile-360-360.png", 198 | "sizes": "360x360" 199 | }, 200 | { 201 | "src": "meta/windows/windowsphone-mediumtile-210-210.png", 202 | "sizes": "210x210" 203 | }, 204 | { 205 | "src": "meta/windows/windowsphone-mediumtile-150-150.png", 206 | "sizes": "150x150" 207 | }, 208 | { 209 | "src": "meta/windows/windowsphone-smalltile-170-170.png", 210 | "sizes": "170x170" 211 | }, 212 | { 213 | "src": "meta/windows/windowsphone-smalltile-99-99.png", 214 | "sizes": "99x99" 215 | }, 216 | { 217 | "src": "meta/windows/windowsphone-smalltile-71-71.png", 218 | "sizes": "71x71" 219 | }, 220 | { 221 | "src": "meta/windows/windowsphone-storelogo-120-120.png", 222 | "sizes": "120x120" 223 | }, 224 | { 225 | "src": "meta/windows/windowsphone-storelogo-70-70.png", 226 | "sizes": "70x70" 227 | }, 228 | { 229 | "src": "meta/windows/windowsphone-storelogo-50-50.png", 230 | "sizes": "50x50" 231 | }, 232 | { 233 | "src": "meta/android/android-launchericon-512-512.png", 234 | "sizes": "512x512" 235 | }, 236 | { 237 | "src": "meta/android/android-launchericon-192-192.png", 238 | "sizes": "192x192" 239 | }, 240 | { 241 | "src": "meta/android/android-launchericon-144-144.png", 242 | "sizes": "144x144" 243 | }, 244 | { 245 | "src": "meta/android/android-launchericon-96-96.png", 246 | "sizes": "96x96" 247 | }, 248 | { 249 | "src": "meta/android/android-launchericon-72-72.png", 250 | "sizes": "72x72" 251 | }, 252 | { 253 | "src": "meta/android/android-launchericon-48-48.png", 254 | "sizes": "48x48" 255 | }, 256 | { 257 | "src": "meta/ios/ios-appicon-1024-1024.png", 258 | "sizes": "1024x1024" 259 | }, 260 | { 261 | "src": "meta/ios/ios-appicon-180-180.png", 262 | "sizes": "180x180" 263 | }, 264 | { 265 | "src": "meta/ios/ios-appicon-152-152.png", 266 | "sizes": "152x152" 267 | }, 268 | { 269 | "src": "meta/ios/ios-appicon-120-120.png", 270 | "sizes": "120x120" 271 | }, 272 | { 273 | "src": "meta/ios/ios-appicon-76-76.png", 274 | "sizes": "76x76" 275 | }, 276 | { 277 | "src": "meta/chrome/chrome-extensionmanagementpage-48-48.png", 278 | "sizes": "48x48" 279 | }, 280 | { 281 | "src": "meta/chrome/chrome-favicon-16-16.png", 282 | "sizes": "16x16" 283 | }, 284 | { 285 | "src": "meta/chrome/chrome-installprocess-128-128.png", 286 | "sizes": "128x128" 287 | }, 288 | { 289 | "src": "meta/firefox/firefox-marketplace-512-512.png", 290 | "sizes": "512x512" 291 | }, 292 | { 293 | "src": "meta/firefox/firefox-marketplace-128-128.png", 294 | "sizes": "128x128" 295 | }, 296 | { 297 | "src": "meta/firefox/firefox-general-256-256.png", 298 | "sizes": "256x256" 299 | }, 300 | { 301 | "src": "meta/firefox/firefox-general-128-128.png", 302 | "sizes": "128x128" 303 | }, 304 | { 305 | "src": "meta/firefox/firefox-general-90-90.png", 306 | "sizes": "90x90" 307 | }, 308 | { 309 | "src": "meta/firefox/firefox-general-64-64.png", 310 | "sizes": "64x64" 311 | }, 312 | { 313 | "src": "meta/firefox/firefox-general-48-48.png", 314 | "sizes": "48x48" 315 | }, 316 | { 317 | "src": "meta/firefox/firefox-general-32-32.png", 318 | "sizes": "32x32" 319 | }, 320 | { 321 | "src": "meta/firefox/firefox-general-16-16.png", 322 | "sizes": "16x16" 323 | } 324 | ], 325 | "start_url": "/?utm_source=homescreen", 326 | "display": "standalone", 327 | "background_color": "#7E040E", 328 | "theme_color": "#DFD6D9" 329 | } -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-144-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-144-144.png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-192-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-192-192.png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-48-48.,png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-48-48.,png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-48-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-48-48.png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-512-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-512-512.png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-72-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-72-72.png -------------------------------------------------------------------------------- /demos/meta/android/android-launchericon-96-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/android/android-launchericon-96-96.png -------------------------------------------------------------------------------- /demos/meta/chrome/chrome-extensionmanagementpage-48-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/chrome/chrome-extensionmanagementpage-48-48.png -------------------------------------------------------------------------------- /demos/meta/chrome/chrome-favicon-16-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/chrome/chrome-favicon-16-16.png -------------------------------------------------------------------------------- /demos/meta/chrome/chrome-installprocess-128-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/chrome/chrome-installprocess-128-128.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-128-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-128-128.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-16-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-16-16.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-256-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-256-256.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-32-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-32-32.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-48-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-48-48.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-64-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-64-64.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-general-90-90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-general-90-90.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-marketplace-128-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-marketplace-128-128.png -------------------------------------------------------------------------------- /demos/meta/firefox/firefox-marketplace-512-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/firefox/firefox-marketplace-512-512.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-appicon-1024-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-appicon-1024-1024.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-appicon-120-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-appicon-120-120.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-appicon-152-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-appicon-152-152.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-appicon-180-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-appicon-180-180.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-appicon-76-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-appicon-76-76.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-1024-768.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-1024-768.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-1242-2208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-1242-2208.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-1334-750.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-1334-750.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-1536-2048.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-1536-2048.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-2048-1536.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-2048-1536.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-2208-1242.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-2208-1242.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-640-1136.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-640-1136.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-640-960.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-640-960.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-750-1334.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-750-1334.png -------------------------------------------------------------------------------- /demos/meta/ios/ios-launchimage-768-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/ios/ios-launchimage-768-1024.png -------------------------------------------------------------------------------- /demos/meta/love2dev-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/love2dev-144x144.png -------------------------------------------------------------------------------- /demos/meta/love2dev-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/love2dev-512x512.png -------------------------------------------------------------------------------- /demos/meta/love2dev-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/love2dev-icon-192x192.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-smallsquare-24-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-smallsquare-24-24.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-smallsquare-30-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-smallsquare-30-30.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-smallsquare-42-42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-smallsquare-42-42.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-smallsquare-54-54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-smallsquare-54-54.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-splashscreen-1116-540.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-splashscreen-1116-540.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-splashscreen-620-300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-splashscreen-620-300.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-splashscreen-868-420.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-splashscreen-868-420.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-squarelogo-120-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-squarelogo-120-120.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-squarelogo-150-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-squarelogo-150-150.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-squarelogo-210-210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-squarelogo-210-210.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-squarelogo-270-270.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-squarelogo-270-270.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-storelogo-50-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-storelogo-50-50.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-storelogo-70-70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-storelogo-70-70.png -------------------------------------------------------------------------------- /demos/meta/windows/windows-storelogo-90-90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windows-storelogo-90-90.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-appicon-106-106.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-appicon-106-106.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-appicon-44-44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-appicon-44-44.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-appicon-62-62.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-appicon-62-62.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-mediumtile-150-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-mediumtile-150-150.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-mediumtile-210-210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-mediumtile-210-210.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-mediumtile-360-360.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-mediumtile-360-360.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-smalltile-170-170.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-smalltile-170-170.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-smalltile-71-71.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-smalltile-71-71.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-smalltile-99-99.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-smalltile-99-99.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-storelogo-120-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-storelogo-120-120.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-storelogo-50-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-storelogo-50-50.png -------------------------------------------------------------------------------- /demos/meta/windows/windowsphone-storelogo-70-70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows/windowsphone-storelogo-70-70.png -------------------------------------------------------------------------------- /demos/meta/windows10/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square310x310Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square310x310Logo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square310x310Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square310x310Logo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square310x310Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square310x310Logo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square310x310Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square310x310Logo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square310x310Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square310x310Logo.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-16_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-16_altform-unplated.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-256_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-256_altform-unplated.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square44x44Logo.targetsize-48_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square44x44Logo.targetsize-48_altform-unplated.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square71x71Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square71x71Logo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square71x71Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square71x71Logo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square71x71Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square71x71Logo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square71x71Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square71x71Logo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/Square71x71Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Square71x71Logo.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /demos/meta/windows10/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /demos/meta/windows10/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /demos/meta/windows10/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /demos/meta/windows10/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /demos/meta/windows10/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/meta/windows10/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /demos/offline/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Love2Dev Add To Homescreen Test Site 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
    33 |


    34 |

    The Love2Dev Custom Add to Homescreen Prompt Manager. You can control how visitors are prompted to add your 35 | Progressive Web App to their device, including iPhone and iPad. 36 |

    37 |

    There are some basic criteria a page must meet in order to qualify to trigger a prompt. There must at least 38 | be a 39 | reference to a web manifest file and a registered service worker. From there you can configure the library 40 | to 41 | follow your own ruleset.

    42 |

    There are several example test pages available to demonstrate how the library can be used. There are several 43 | custom properties and settings you can use to control how the native and non-native prompts are triggered. 44 |

    45 |

    Chrome and the Chromium based Edge support a native prompt for both Android and desktops. If available this 46 | is 47 | the default choice. The library catches the beforeinstall event to reference the event object and display 48 | the 49 | native prompt according to the custom ruleset.

    50 |

    Classic Edge does not have an Add to Desktop feature, so no prompt should display. This will be the general 51 | rule 52 | in any browser that does not have some sort of homescreen support, like desktop FireFox.

    53 |


    54 |
    55 | 56 |
    57 |
    58 |
    General Sample
    59 |

    A set of properties and values passed to the library to demonstrate its 60 | flexibility.

    61 | Try it Out 62 |
    63 |
    64 |
    65 |
    66 |
    Custom Trigger
    67 |

    Trigger the prompt mannually by calling the trigger method.

    68 | Try it Out 69 |
    70 |
    71 |
    72 |
    73 |
    Custom Criteria
    74 |

    Sets the customCriteria property to demonstrate how you can control if a prompt 75 | can 76 | be displayed using a custom function or simply passing true or false.

    77 | Try it Out 78 |
    79 |
    80 |
    81 |
    82 |
    iPhone
    83 |

    Using the debug property to mannually set the platform (browser) to iPhone. 84 | Note: 85 | Safari is the only iOS browser supported by Apple restrictions. So psuedo browsers like Chrome, 86 | Edge 87 | & FireFox are excluded.

    88 | Try it Out 89 |
    90 |
    91 |
    92 |
    93 |
    iPad
    94 |

    Using the debug property to mannually set the platform (browser) to iPad. Note: 95 | Safari is the only iOS browser supported by Apple restrictions. So psuedo browsers like Chrome, 96 | Edge 97 | & FireFox are excluded.

    98 | Try it Out 99 |
    100 |
    101 |
    102 |
    103 |
    FireFox
    104 |

    Using the debug property to mannually set the platform (browser) to FireFox. 105 | Note: 106 | FireFox only supports Add to Homescreen on Android.

    107 | Try it Out 108 |
    109 |
    110 |
    111 |
    112 |
    Opera
    113 |

    Using the debug property to mannually set the platform (browser) to FireFox. 114 | Note: 115 | Opera only supports Add to Homescreen on Android.

    116 | Try it Out 117 |
    118 |
    119 |
    120 |
    121 |
    Samsung
    122 |

    Using the debug property to mannually set the platform (browser) to FireFox. 123 | Note: 124 | Samsung only supports Add to Homescreen on Android.

    125 | Try it Out 126 |
    127 |
    128 |
    129 |
    130 |
    Inline
    131 |

    Display an inline promotion.

    132 | Try it Out 133 |
    134 |
    135 |
    136 |
    137 |
    138 |
    139 | 140 |
    141 |
    142 | 143 |
    144 | 160 | 161 | 162 | 268 | 269 | 270 | -------------------------------------------------------------------------------- /demos/opera/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
    31 |


    32 |

    Uses the debug option, set to 'opera', to help test the Opera Browser experience.

    33 |
    34 | 35 |
    36 |
    37 |
    38 |
    39 |
    40 | 56 | 57 | 58 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /demos/samsung/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home - Samsung Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
    31 |


    32 |

    Uses the debug option, set to 'samsung', to help test the Samsung Internet Browser experience.

    33 |
    34 | 35 |
    36 | 37 |
    38 |
    39 |
    40 |
    41 | 57 | 58 | 59 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /demos/style/addtohomescreen.css: -------------------------------------------------------------------------------- 1 | .ath-container { 2 | position: fixed; 3 | display: none; 4 | flex-direction: column; 5 | z-index: 1000; 6 | width: 100vw; 7 | background-color: #eee; 8 | color: #000; 9 | padding: 1%; 10 | text-align: center; 11 | } 12 | 13 | .ath-banner { 14 | display: flex; 15 | flex-direction: row; 16 | justify-content: center; 17 | position: relative; 18 | } 19 | 20 | .ath-banner-title { 21 | width: 40%; 22 | text-align: center; 23 | font-size: 1rem; 24 | display: flex; 25 | align-items: center; 26 | justify-content: center; 27 | } 28 | 29 | .ath-banner-cell-2x, 30 | .ath-banner-cell { 31 | width: 20%; 32 | margin: 5px; 33 | display: flex; 34 | align-items: center; 35 | justify-content: center; 36 | } 37 | 38 | .ath-banner-cell-2x { 39 | width: 120px; 40 | } 41 | 42 | .ath-banner-cell-sm, 43 | .ath-banner-cell-md, 44 | .ath-banner-cell-lg, 45 | .ath-banner-cell-xl { 46 | display: none; 47 | } 48 | 49 | .log-target { 50 | overflow-wrap: break-word; 51 | } 52 | 53 | 54 | .banner-top-left { 55 | top: 0; 56 | left: 0; 57 | } 58 | 59 | .banner-top-right { 60 | top: 0; 61 | right: 0; 62 | } 63 | 64 | .banner-bottom-left { 65 | left: 0; 66 | bottom: 0; 67 | } 68 | 69 | .banner-bottom-right { 70 | right: 0; 71 | bottom: 0; 72 | } 73 | 74 | .banner-center { 75 | left: 25%; 76 | top: 25%; 77 | } 78 | 79 | .banner-center-left { 80 | top: 25%; 81 | left: 0; 82 | } 83 | 84 | .banner-center-right { 85 | top: 25%; 86 | right: 0; 87 | } 88 | 89 | .banner-top-center { 90 | width: 50%; 91 | left: 25%; 92 | top: 12px; 93 | } 94 | 95 | .banner-bottom-center { 96 | bottom: 0; 97 | } 98 | 99 | .ath-guidance img { 100 | position: absolute; 101 | bottom: 0; 102 | } 103 | 104 | 105 | @media (min-width: 576px) { 106 | 107 | .banner-dialog-centered { 108 | min-height: calc(100% - 3.5rem); 109 | } 110 | 111 | .ath-banner-cell { 112 | width: 90px; 113 | margin: 3px; 114 | } 115 | 116 | .ath-banner-cell-sm { 117 | display: flex; 118 | } 119 | 120 | } 121 | 122 | @media(min-width: 768px) { 123 | 124 | .ath-banner-title { 125 | width: calc(100% - 360px); 126 | } 127 | 128 | .ath-banner-cell-2x, 129 | .ath-banner-cell { 130 | width: 120px; 131 | } 132 | 133 | .ath-banner-cell-2x { 134 | width: 160px; 135 | } 136 | 137 | .ath-banner-cell-md { 138 | display: flex; 139 | } 140 | 141 | } 142 | 143 | @media (min-width: 992px) { 144 | 145 | .banner-lg { 146 | width: 50%; 147 | } 148 | 149 | .banner-lg-top-center { 150 | left: 25%; 151 | top: 12px; 152 | } 153 | 154 | .banner-lg-bottom-center { 155 | left: 25%; 156 | bottom: 12px; 157 | } 158 | 159 | .banner-bottom-center { 160 | width: 60%; 161 | left: 20%; 162 | } 163 | 164 | .ath-container img { 165 | left: 15%; 166 | } 167 | 168 | .ath-banner-cell-lg { 169 | display: flex; 170 | } 171 | 172 | } 173 | 174 | @media (min-width: 1200px) { 175 | 176 | .ath-banner-cell-lg { 177 | display: flex; 178 | } 179 | 180 | } 181 | 182 | .edge-wrapper, 183 | .firefox-wrapper, 184 | .samsung-wrapper, 185 | .opera-home-screen-wrapper { 186 | opacity: 0; 187 | } 188 | 189 | .firefox-wrapper, 190 | .samsung-wrapper, 191 | .opera-home-screen-wrapper { 192 | bottom: 21px; 193 | } 194 | 195 | .opera-home-screen-wrapper { 196 | width: 100%; 197 | max-width: 483px; 198 | right: 6px; 199 | left: auto; 200 | } 201 | 202 | .ipad-wrapper img { 203 | position: absolute; 204 | top: 0; 205 | } 206 | 207 | .animated.delay-7s { 208 | animation-delay: 7s; 209 | } 210 | 211 | .overlay-1 { 212 | z-index: 2020; 213 | } 214 | 215 | .overlay-2 { 216 | z-index: 2040; 217 | } 218 | 219 | .overlay { 220 | position: absolute; 221 | top: 0; 222 | bottom: 0; 223 | left: 0; 224 | right: 0; 225 | height: 100%; 226 | width: 100%; 227 | opacity: 0; 228 | transition: .3s ease; 229 | } 230 | 231 | .ath-container p { 232 | margin: 0; 233 | padding: 0; 234 | position: relative; 235 | z-index: 2147483642; 236 | text-shadow: 0 0.1em 0 #fff; 237 | font-size: 1.1em; 238 | } -------------------------------------------------------------------------------- /demos/style/site.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --love2dev-red-darkest: #250000; 3 | --love2dev-red-darker: #490000; 4 | --love2dev-red-dark: #6E0000; 5 | --love2dev-red: #7A0000; 6 | --love2dev-red-light: #A24D4D; 7 | --love2dev-red-lighter: #CA9999; 8 | --love2dev-red-lightest: #F2E6E6; 9 | 10 | --love2dev-white-darkest: #4C4C4C; 11 | --love2dev-white-darker: #989898; 12 | --love2dev-white-dark: #E5E5E5; 13 | --love2dev-white: #FEFEFE; 14 | --love2dev-white-light: #FEFEFE; 15 | --love2dev-white-lighter: #FFFFFF; 16 | --love2dev-white-lightest: #FFFFFF; 17 | 18 | --love2dev-dark-darkest: #101113; 19 | --love2dev-dark-darker: #1F2326; 20 | --love2dev-dark-dark: #2F343A; 21 | --love2dev-dark: #343A40; 22 | --love2dev-dark-light: #717579; 23 | --love2dev-dark-lighter: #AEB0B3; 24 | --love2dev-dark-lightest: #EBEBEC; 25 | } 26 | 27 | html, 28 | body { 29 | height: 100%; 30 | width: 100%; 31 | } 32 | 33 | body { 34 | margin: 0; 35 | background-color: var(--love2dev-white); 36 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 37 | display: flex; 38 | flex-direction: column; 39 | font-size: calc(0.9rem + .5vw); 40 | } -------------------------------------------------------------------------------- /demos/sw.js: -------------------------------------------------------------------------------- 1 | //remember to increment the version # when you update the service worker 2 | const version = "1.00", 3 | preCache = "PRECACHE-" + version, 4 | cacheList = [ "offline/" ], 5 | dashboardDocs = [], 6 | image_fallback = "img/offline.png", 7 | doc_fallback = "offline/", 8 | dynamicCache = "DYNAMIC_CACHE" + version, 9 | noCache = [], 10 | DEFAULT_MAX_TIME = 10 * 60 * 1000, //10 minute for testing 11 | SINGLE_DAY = 24 * 60 * 60 * 1000, //1 day for testing 12 | NO_CACHE = /no-cache|no-store|must-revalidate/, 13 | mime_types = { 14 | "application/json": "json", 15 | "video/mp4": "blob", 16 | "image/jpg": "blob", 17 | "image/png": "blob", 18 | "image/gif": "blob", 19 | "application/octet-stream": "blob", 20 | "mp4": "video/mp4", 21 | "jpg": "image/jpg", 22 | "png": "image/png", 23 | "gif": "image/gif" 24 | }, 25 | LAST_ASSET_CHECK = "last-asset-check", 26 | LAST_DYNAMIC_CHECK = "last-dynamic-check", 27 | LAST_PRECACHE_CHECK = "last-precache-check", 28 | UPDATE_DYNAMIC = "update-dynamic"; 29 | 30 | const success = [ "background: green", "color: white", "display: block", "text-align: center" ].join( ";" ); 31 | 32 | let requestLog = []; 33 | 34 | 35 | /* 36 | create a list (array) of urls to pre-cache for your application 37 | */ 38 | 39 | /* Service Worker Event Handlers */ 40 | 41 | self.addEventListener( "install", function ( event ) { 42 | 43 | event.waitUntil( updatePreCache() ); 44 | 45 | } ); 46 | 47 | self.addEventListener( "activate", function ( event ) { 48 | 49 | event.waitUntil( 50 | 51 | //wholesale purge of previous version caches 52 | caches.keys() 53 | .then( cacheNames => { 54 | 55 | cacheNames.forEach( value => { 56 | 57 | if ( !value.includes( version ) ) { 58 | caches.delete( value ); 59 | } 60 | 61 | } ); 62 | 63 | return; 64 | 65 | } ) 66 | 67 | ); 68 | 69 | } ); 70 | 71 | self.addEventListener( "fetch", function ( event ) { 72 | 73 | event.respondWith( 74 | 75 | handleRequest( event ) 76 | .catch( err => { 77 | //assume offline as everything else should be handled 78 | return caches.match( doc_fallback, { 79 | ignoreSearch: true 80 | } ); 81 | 82 | } ) 83 | 84 | ); 85 | 86 | } ); 87 | 88 | self.addEventListener( "message", event => { 89 | 90 | console.log( event ); 91 | 92 | switch ( event.data.event ) { 93 | 94 | case UPDATE_DYNAMIC: 95 | 96 | cacheCoreAssets(); 97 | 98 | break; 99 | 100 | //case UPDATE_DASHBOARD: 101 | 102 | // updateDashboard(); 103 | // break; 104 | 105 | // case OFFLINE_MSG_KEY: 106 | 107 | // toggleOffline( event.data.state ); 108 | 109 | // break; 110 | 111 | 112 | default: 113 | 114 | console.log( "unhandled event" ); 115 | 116 | break; 117 | } 118 | 119 | } ); 120 | 121 | function handleRequest( event ) { 122 | 123 | if ( event.request.method.toLowerCase() !== "get" ) { 124 | 125 | return fetch( event.request ) 126 | .catch( err => { 127 | return handleOffline( event.request ); 128 | } ); 129 | 130 | } else { 131 | 132 | return fetch( event.request ); 133 | 134 | } 135 | 136 | } 137 | 138 | 139 | function updatePreCache() { 140 | 141 | return updateCachedAssets( preCache ); 142 | } 143 | 144 | function fetchHead( url, cache ) { 145 | 146 | return cache.match( url, { 147 | ignoreSearch: true 148 | } ) 149 | .then( response => { 150 | 151 | if ( response ) { 152 | 153 | return fetch( url, { 154 | method: "HEAD" 155 | } ) 156 | .then( function ( response ) { 157 | 158 | if ( !response.ok ) { 159 | return false; 160 | } 161 | 162 | let lastModified = response.headers.get( "last-modified" ); 163 | 164 | if ( lastModified ) { 165 | 166 | return cache.match( url, { 167 | ignoreSearch: true 168 | } ) 169 | .then( cachedResponse => { 170 | 171 | if ( cachedResponse ) { 172 | 173 | let cachedModified = cachedResponse.headers.get( "last-modified" ); 174 | 175 | if ( new Date( lastModified ) > new Date( cachedModified ) ) { 176 | 177 | return fetchAndCache( url, cache ); 178 | 179 | } 180 | 181 | } else { 182 | 183 | return fetchAndCache( url, cache ); 184 | 185 | } 186 | 187 | } ); 188 | 189 | } else { 190 | return fetchAndCache( url, cache ); 191 | } 192 | 193 | } ) 194 | .catch( () => { 195 | return false; 196 | } ); 197 | 198 | } else { 199 | return fetchAndCache( url, cache ); 200 | } 201 | 202 | } ); 203 | 204 | } 205 | 206 | let cacheUpdate = []; 207 | 208 | function fetchAndCache( url, cache ) { 209 | 210 | return fetch( url ) 211 | .then( function ( response ) { 212 | 213 | if ( [ 0, 200, 204 ].includes( response.status ) ) { 214 | 215 | cacheUpdate.push( url ); 216 | 217 | return cache.put( url, response ); 218 | 219 | } else { 220 | 221 | console.error( "bad response status - " + response.url ); 222 | 223 | } 224 | 225 | } ) 226 | .catch( err => { 227 | console.error( err ); 228 | } ); 229 | 230 | } 231 | 232 | function purgeDynamicCache() { 233 | 234 | return caches.open( dynamicCache ) 235 | .then( cache => { 236 | 237 | let actions = []; 238 | 239 | for ( let i = 0; i < dashboardDocs.length; i++ ) { 240 | 241 | actions.push( cache.delete( dashboardDocs[ i ] ) ); 242 | 243 | } 244 | 245 | return Promise.all( actions ); 246 | 247 | } ); 248 | 249 | } 250 | 251 | function replaceDynamicCachedAssets() { 252 | 253 | return caches.open( preCache ) 254 | .then( cache => { 255 | 256 | let actions = []; 257 | 258 | for ( let i = 0; i < dashboardDocs.length; i++ ) { 259 | 260 | //change this to check the existing cache for any update needed 261 | actions.push( fetchHead( dashboardDocs[ i ], cache ) ); 262 | } 263 | 264 | return Promise.all( actions ) 265 | .catch( err => { 266 | console.error( err ); 267 | } ); 268 | 269 | } ); 270 | 271 | } 272 | 273 | function cacheResponse( request, response, cache_name ) { 274 | 275 | return caches.open( cache_name ) 276 | .then( cache => { 277 | 278 | return cache.put( request, response ); 279 | 280 | } ); 281 | 282 | } 283 | 284 | function getSrcUrl( url ) { 285 | 286 | let _url = new URL( url ); 287 | 288 | let srcUrl = _url.pathname; 289 | 290 | if ( srcUrl.charAt( 0 ) === "/" ) { 291 | srcUrl = srcUrl.substring( 1 ); 292 | } 293 | 294 | return srcUrl; 295 | 296 | } 297 | 298 | function getFileExtension( pathname ) { 299 | 300 | let pathParts = pathname.split( "." ); 301 | 302 | return ( pathParts.length > 1 ) ? pathParts[ 1 ] : ""; 303 | 304 | } 305 | 306 | 307 | function handleOffline( request ) { 308 | 309 | let url = ""; 310 | 311 | if ( typeof request === "string" ) { 312 | url = url; 313 | } else { 314 | url = request.url; 315 | } 316 | 317 | //place handlers for different routes here 318 | //should have fallback responses for different routes and mime-types 319 | 320 | if ( ( /\.jpg|\.png|\.gif/i ).test( url ) ) { 321 | 322 | return caches.match( image_fallback ); 323 | 324 | } else { 325 | return caches.match( doc_fallback ); 326 | } 327 | 328 | } 329 | 330 | function daysDifferent( d1, d2 ) { 331 | var t2 = d2.getTime(); 332 | var t1 = d1.getTime(); 333 | 334 | return parseInt( ( t2 - t1 ) / ( 24 * 3600 * 1000 ) ); 335 | } 336 | 337 | function cacheFirstNetwork( event ) { 338 | 339 | return handleDocument( event.request ) 340 | .then( response => { 341 | 342 | if ( response ) { 343 | 344 | return response; 345 | 346 | } else { 347 | 348 | return fetch( event.request ) 349 | .then( response => { 350 | //too much complexity, refactor 351 | 352 | if ( [ 200, 204 ].includes( response.status ) ) { 353 | 354 | let ContentType = response.headers.get( "content-type" ); 355 | 356 | if ( isCacheable( event.request.url ) && 357 | event.request.method.toLowerCase() === "get" && 358 | ContentType && 359 | !ContentType.toLowerCase().includes( "application/json" ) 360 | ) { 361 | 362 | if ( ContentType.toLowerCase().includes( "text/html" ) ) { 363 | 364 | //return processHTML(response); 365 | return response; 366 | 367 | } else { 368 | 369 | return cacheResponse( event.request, response.clone(), dynamicCache ) 370 | .then( () => { 371 | 372 | return response; 373 | 374 | } ); 375 | 376 | } 377 | 378 | } else { 379 | return response; 380 | } 381 | 382 | } else { 383 | 384 | return response; 385 | 386 | } 387 | 388 | } ); 389 | 390 | } 391 | 392 | } ); 393 | 394 | } 395 | 396 | function isCacheable( url ) { 397 | 398 | let u = new URL( url ); 399 | 400 | return !noCache.includes( u.pathname ); 401 | 402 | } 403 | 404 | function networkCache( event ) { 405 | 406 | //if offline then return from cache 407 | //if within cache TTL then return from cache 408 | //if TTL expired fetch from network then cache 409 | //always update from network 410 | 411 | } 412 | 413 | function updateCachedAssets( cacheName ) { 414 | 415 | return caches.open( cacheName ) 416 | .then( cache => { 417 | 418 | cacheList.forEach( url => { 419 | 420 | return fetchHead( url, cache ); 421 | 422 | } ); 423 | 424 | } ) 425 | .then( () => { 426 | 427 | self.skipWaiting(); 428 | 429 | console.log( "pre-cached assets complete. the following URLs were updated" ); 430 | console.table( cacheUpdate, success ); 431 | 432 | } ); 433 | 434 | } 435 | 436 | function handleDocument( request ) { 437 | 438 | if ( request.destination === "document" ) { 439 | 440 | return fetch( request ); 441 | //.then(processHTML); 442 | 443 | } else { 444 | 445 | return caches.match( request, { 446 | ignoreSearch: true 447 | } ); 448 | } 449 | 450 | } -------------------------------------------------------------------------------- /demos/trigger/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Add To Home 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
    38 |
    39 |

    Using a Custom Trigger to control if the Add to Homescreen Banner can be displayed

    40 |
    41 |
    42 |
    43 |
    44 |
    45 | 61 | 62 | 63 | 64 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /demos/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /demos/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /demos/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /demos/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /demos/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /demos/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /demos/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /demos/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /demos/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /demos/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /demos/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /demos/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /demos/webfonts/fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fontello.eot -------------------------------------------------------------------------------- /demos/webfonts/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fontello.ttf -------------------------------------------------------------------------------- /demos/webfonts/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fontello.woff -------------------------------------------------------------------------------- /demos/webfonts/fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/demos/webfonts/fontello.woff2 -------------------------------------------------------------------------------- /imgs/action-icon-android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/action-icon-android.png -------------------------------------------------------------------------------- /imgs/action-icon-ios6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/action-icon-ios6.png -------------------------------------------------------------------------------- /imgs/action-icon-ios7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/action-icon-ios7.png -------------------------------------------------------------------------------- /imgs/chromium-add2hs-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/chromium-add2hs-modal.png -------------------------------------------------------------------------------- /imgs/common-a2hs-touch-hold-mannually-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/common-a2hs-touch-hold-mannually-modal.png -------------------------------------------------------------------------------- /imgs/example-pwa-prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/example-pwa-prompt.png -------------------------------------------------------------------------------- /imgs/firefox-a2hs-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/firefox-a2hs-icon.png -------------------------------------------------------------------------------- /imgs/firefox-a2hs-prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/firefox-a2hs-prompt.png -------------------------------------------------------------------------------- /imgs/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/icon-152x152.png -------------------------------------------------------------------------------- /imgs/icon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/icon-16x16.png -------------------------------------------------------------------------------- /imgs/icon-196x196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/icon-196x196.png -------------------------------------------------------------------------------- /imgs/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 28 | 32 | 36 | 37 | 40 | 44 | 48 | 49 | 52 | 56 | 60 | 61 | 71 | 81 | 91 | 92 | 114 | 116 | 117 | 119 | image/svg+xml 120 | 122 | 123 | 124 | 125 | 126 | 131 | 140 | 148 | 154 | 160 | 166 | 172 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /imgs/install-pwa-chrome-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/install-pwa-chrome-menu.png -------------------------------------------------------------------------------- /imgs/install-pwa-edge-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/install-pwa-edge-menu.png -------------------------------------------------------------------------------- /imgs/ios-safari-share-button-highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/ios-safari-share-button-highlight.jpg -------------------------------------------------------------------------------- /imgs/iphone-a2hs-icon-highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/iphone-a2hs-icon-highlight.jpg -------------------------------------------------------------------------------- /imgs/iphone-a2hs-swipe-to-right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/iphone-a2hs-swipe-to-right.jpg -------------------------------------------------------------------------------- /imgs/iphone-a2hs-swipe-to-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/iphone-a2hs-swipe-to-right.png -------------------------------------------------------------------------------- /imgs/opera-add-to-homescreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/opera-add-to-homescreen.png -------------------------------------------------------------------------------- /imgs/safari-ipad-share-a2hs-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/safari-ipad-share-a2hs-right.png -------------------------------------------------------------------------------- /imgs/safari-ipad-share-a2hs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/safari-ipad-share-a2hs.png -------------------------------------------------------------------------------- /imgs/samsung-internet-a2hs-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/imgs/samsung-internet-a2hs-icon.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "add-to-homescreen", 3 | "version": "2.0.0", 4 | "description": "Manage the Progressive Web Application 'installation' Prompt across platforms.", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "http-server demos/ -p 9001 -c -i", 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "build": "bin/index.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/docluv/add-to-homescreen.git" 14 | }, 15 | "keywords": [ 16 | "PWA", 17 | "Progressive Web App", 18 | "Add to Homescreen" 19 | ], 20 | "author": "Chris Love", 21 | "license": "ISC", 22 | "bugs": { 23 | "url": "https://github.com/docluv/add-to-homescreen/issues" 24 | }, 25 | "homepage": "https://github.com/docluv/add-to-homescreen#readme", 26 | "dependencies": { 27 | "http-server": "^0.11.1", 28 | "uglify": "*", 29 | "uglify-es": "*" 30 | } 31 | } -------------------------------------------------------------------------------- /project.todo: -------------------------------------------------------------------------------- 1 | Prompt Script: 2 | ✔ add ability to log to external method @done (7/10/2020, 11:00:53 AM) 3 | ☐ separate UI prompt from prompt verification logic 4 | ☐ modify prompt configuration to allow multiple prompts on a page 5 | ✔ prompt callback should indicate platform @done (7/10/2020, 11:01:03 AM) 6 | ✔ if beforeinstallprompt then indicate so client will know how to display guidance and trigger native prompt @done (7/10/2020, 11:01:14 AM) 7 | 8 | Prompt Management: 9 | 10 | 11 | General Project: 12 | ☐ Read Short Name from Manifest File if it is a PWA & only when prompt needs to be displayed @low 13 | ☐ trigger a redirect back to the home page for iOS @low ** get from pwa compat ** 14 | -------------------------------------------------------------------------------- /src/addtohomescreen.min.js: -------------------------------------------------------------------------------- 1 | !function(e,o,t){"use strict";let n,i,s,a=!1,l={added:!1},r={isCompatible:!1,beforeInstallPrompt:null},d={},p={appID:"com.love2dev.addtohome",appName:"Progressive Web App",debug:!1,logging:!1,modal:!1,mandatory:!1,autostart:!0,skipFirstVisit:!1,minSessions:0,startDelay:1,lifespan:15,displayPace:1,mustShowCustomPrompt:!1,maxDisplayCount:0,validLocation:[],onInit:null,onShow:null,onAdd:null,onInstall:null,onCancel:null,customCriteria:null,manualPrompt:null};const u={lastDisplayTime:0,returningVisitor:!1,displayCount:0,optedout:!1,added:!1,sessions:0,nextSession:0};function c(e){if(!n)if(n={trigger:C,updateSession:v,clearSession:A,removeSession:f,optOut:w,optIn:P,clearDisplayCount:D,triggerNativePrompt:g},"serviceWorker"in navigator){o.querySelector("[rel='manifest']")?(d=Object.assign({},p,e),navigator.serviceWorker.getRegistration().then(h)):console.log("no manifest file")}else m("service worker not supported"),m("Add to homescreen: not displaying callout because service workers are not supported");return n}function m(e){d.logging&&(d.logger?d.logger.log(e):console.log(e))}async function g(){if(!r.beforeInstallPrompt)return Promise.resolve();try{await r.beforeInstallPrompt.prompt();const e=await r.beforeInstallPrompt.userChoice;l.added="accepted"===e.outcome,l.added?(m("User accepted the A2HS prompt"),d.onAdd&&d.onAdd(e)):(d.onCancel&&d.onCancel(e),l.optedout=!0,m("User dismissed the A2HS prompt")),v(),r.beforeInstallPrompt=null}catch(e){if(m(e.message),e.message.indexOf("user gesture")>-1)d.mustShowCustomPrompt=!0,S();else{if(!(e.message.indexOf("The app is already installed")>-1))return console.log(e),e;l.added=!0,v()}}}function f(e){localStorage.removeItem(e||c.defaults.appID)}async function h(t){if(n.sw=t,!n.sw)return console.log("no service worker"),void(r.isCompatible=!1);(l=JSON.parse(localStorage.getItem(d.appID)))||(l=u),"string"==typeof l&&(l=JSON.parse(l)),l.sessions+=1,v(),function(){const t=e.navigator.userAgent;r.isIDevice=/iphone|ipod|ipad|macintosh/i.test(t)&&"ontouchend"in o,r.isSamsung=/Samsung/i.test(t),r.isFireFox=/Firefox/i.test(t),r.isOpera=/opr/i.test(t),r.isEdge=/Edg/i.test(t),r.isChrome=/Chrome/.test(t)&&!r.isEdge,r.isAndroid=/android/i.test(t),r.isWindows=/Windows NT/i.test(t),r.isMacOS=/Macintosh/i.test(t)&&!r.isIDevice,r.isFireFox&&(r.isFireFox=/android/i.test(t)),r.isOpera&&(r.isOpera=/android/i.test(t)),r.isChromium="onbeforeinstallprompt"in e,r.isInWebAppiOS=!0===e.navigator.standalone,r.isInWebAppChrome=e.matchMedia("(display-mode: standalone)").matches,r.isMobileSafari=r.isIDevice&&t.indexOf("Safari")>-1&&t.indexOf("CriOS")<0,r.isStandalone=r.isInWebAppiOS||r.isInWebAppChrome||e.matchMedia("(display-mode: fullscreen)").matches,r.isiPad=r.isMobileSafari&&t.indexOf("iPad")>-1,r.isiPhone=r.isMobileSafari&&-1===t.indexOf("iPad"),r.isCompatible=r.isChromium||r.isMobileSafari||r.isSamsung||r.isFireFox||r.isOpera||r.isIDevice,r.isInstalled=l.added,r.isStandalone&&(l.added=!0,r.isInstalled=!0,v())}(),d&&d.debug&&void 0===d.logging&&(d.logging=!0),d.mandatory=d.mandatory&&("standalone"in e.navigator||d.debug),d.modal=d.modal||d.mandatory,d.mandatory&&(d.startDelay=-.5),d.debug&&(r.isCompatible=!0),d.onInit&&d.onInit(n),d.autostart?(m("Add to homescreen: autostart displaying callout"),b()):a?I():b()}function y(){if(null!==d.customCriteria||d.customCriteria!==t){let e=!1;return e="function"==typeof d.customCriteria?d.customCriteria():!!d.customCriteria,d.customCriteria=e,e||m("Add to homescreen: not displaying callout because a custom criteria was not met."),e}return d.customCriteria}function b(e){!l.shown||e?(l.shown=!0,"interactive"===o.readyState||"complete"===o.readyState?S():o.onreadystatechange=function(){"complete"===o.readyState&&S()}):m("Add to homescreen: not displaying callout because already shown on screen")}function S(e){setTimeout(I,1e3*d.startDelay+500)}function I(){(i!==t?i:(i=!1,r.isInstalled?i:y()?r.isCompatible?Date.now()-l.lastDisplayTime<6e4*d.displayPace?(m("Add to homescreen: not displaying callout because displayed recently"),0):d.maxDisplayCount&&l.displayCount>=d.maxDisplayCount?(m("Add to homescreen: not displaying callout because displayed too many times already"),0):l.sessions0&&l.sessions>=d.nextSession?(m("Add to homescreen: not displaying callout because waiting on session "+d.nextSession),0):l.optedout?(m("Add to homescreen: not displaying callout because user opted out"),0):l.added?(m("Add to homescreen: not displaying callout because already added to the homescreen"),0):r.isStandalone?(l.added||(l.added=!0,v(),d.onAdd&&d.onAdd(n,l)),m("Add to homescreen: not displaying callout because in standalone mode"),0):!l.returningVisitor&&(l.returningVisitor=!0,v(),d.skipFirstVisit)?(m("Add to homescreen: not displaying callout because skipping first visit"),0):(i=!0,1):(m("Add to homescreen: not displaying callout because device not supported"),0):(s=!1,0)))?(n.beforeInstallPrompt="onbeforeinstallprompt"in e,d.onShow&&d.onShow(r,l,n),l.lastDisplayTime=Date.now(),l.displayCount++,v()):(s!==t?s:(s=!1,n.beforeInstallPrompt="onbeforeinstallprompt"in e,y()?l.optedout||l.added||r.isStandalone||!r.isCompatible||r.isInWebAppiOS?s:(s=!0,1):(s=!1,0)))?d.onCanInstall&&d.onCanInstall(r,l,n):r.isInstalled?d.onInstalled&&d.onInstalled(r,l,n):r.isCompatible&&d.onShow&&!r.isInstalled&&d.onShow(r,l,n)}function C(){I()}function v(){localStorage.setItem(d.appID,JSON.stringify(l))}function A(){l=u,v()}function w(){l.optedout=!0,v()}function P(){l.optedout=!1,v()}function D(){l.displayCount=0,l.shown=!1,l.lastDisplayTime=0,v()}"onbeforeinstallprompt"in e&&(e.addEventListener("beforeinstallprompt",function(e){e.preventDefault(),r.beforeInstallPrompt=e,d.onBeforeInstallPrompt&&d.onBeforeInstallPrompt(r)}),a=!0),"onappinstalled"in e&&e.addEventListener("appinstalled",e=>{m("a2hs installed"),l.added=!0,v(),d.onInstall&&d.onInstall(e)}),r.cancelPrompt=function(e){return e.preventDefault(),d.onCancel&&d.onCancel(),!1},r.handleInstall=function(e){var o;return d.onInstall&&d.onInstall(e),!r.beforeInstallPrompt||d.debug&&"native"!==(d.debug&&"string"==typeof d.debug?d.debug:r.isChromium&&o===t&&!o?"native":r.isFireFox?"firefox":r.isiPad?"ipad":r.isiPhone?"iphone":r.isOpera?"opera":r.isSamsung?"samsung":r.isEdge?"edge":r.isChromium?"chromium":"")||g(),!1},e.addToHomescreen=c}(window,document); -------------------------------------------------------------------------------- /src/desktop-ua.tsv: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.3 27.66 2 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.3 9.07 3 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.1 8.05 4 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.1 6.69 5 | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127. 6.35 6 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.3 5.9 7 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.1 5.33 8 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.1 4.65 9 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0. 4.08 10 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0. 4.08 11 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0. 3.17 12 | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126. 1.81 13 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.3 1.36 14 | Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115. 1.36 15 | Mozilla/5.0 (Windows NT 6.1; rv:109.0) Gecko/20100101 Firefox/115. 0.91 16 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 OPR/110.0.0. 0.91 17 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.3 0.91 18 | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115. 0.91 19 | Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.3 0.91 20 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/25.0 Chrome/121.0.0.0 Safari/537.3 0.45 21 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.3 0.45 22 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.3 0.45 23 | Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113. 0.45 24 | Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Geck 0.45 25 | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118. 0.45 26 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.3 0.45 27 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 OPR/109.0.0. 0.45 28 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.3 0.45 29 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.3 0.45 30 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.4 0.45 31 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.5 0.45 32 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Avast/125.0.0. 0.45 -------------------------------------------------------------------------------- /src/mobile-ua.tsv: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.3 45.05 2 | Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604. 27.47 3 | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/25.0 Chrome/121.0.0.0 Mobile Safari/537.3 7.69 4 | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.3 6.59 5 | Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.54 Mobile/15E148 Safari/604. 3.3 6 | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.3 2.2 7 | Mozilla/5.0 (Linux; Android 11; moto e20 Build/RONS31.267-94-14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.179 Mobile Safari/537.3 2.2 8 | Mozilla/5.0 (iPhone; CPU iPhone OS 15_8_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.6 Mobile/15E148 Safari/604. 1.1 9 | Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604. 1.1 10 | Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/320.0.639621854 Mobile/15E148 Safari/604. 1.1 11 | Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/126.2 Mobile/15E148 Safari/605.1.1 1.1 12 | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.3 1.1 -------------------------------------------------------------------------------- /src/session.json: -------------------------------------------------------------------------------- 1 | { 2 | "lastDisplayTime": 1556126427693, 3 | "returningVisitor": true, 4 | "displayCount": 125, 5 | "optedout": false, 6 | "added": true, 7 | "requireActiveSW": true, 8 | "sessions": 128 9 | } -------------------------------------------------------------------------------- /style/addtohomescreen.css: -------------------------------------------------------------------------------- 1 | .ath-container { 2 | position: fixed; 3 | display: none; 4 | flex-direction: column; 5 | z-index: 1000; 6 | width: 100%; 7 | background-color: #eee; 8 | color: #000; 9 | padding: 1%; 10 | text-align: center; 11 | } 12 | 13 | .ath-banner { 14 | display: flex; 15 | flex-direction: row; 16 | justify-content: center; 17 | position: relative; 18 | } 19 | 20 | .ath-banner-title { 21 | width: calc(100% - 240px); 22 | text-align: center; 23 | font-size: 1rem; 24 | display: flex; 25 | align-items: center; 26 | justify-content: center; 27 | } 28 | 29 | .ath-banner-cell-2x, 30 | .ath-banner-cell { 31 | width: 70px; 32 | margin: 5px; 33 | display: flex; 34 | align-items: center; 35 | justify-content: center; 36 | } 37 | 38 | .ath-banner-cell-2x { 39 | width: 120px; 40 | } 41 | 42 | .log-target { 43 | overflow-wrap: break-word; 44 | } 45 | 46 | 47 | .banner-top-left { 48 | top: 0; 49 | left: 0; 50 | } 51 | 52 | .banner-top-right { 53 | top: 0; 54 | right: 0; 55 | } 56 | 57 | .banner-bottom-left { 58 | left: 0; 59 | bottom: 0; 60 | } 61 | 62 | .banner-bottom-right { 63 | right: 0; 64 | bottom: 0; 65 | } 66 | 67 | .banner-center { 68 | left: 25%; 69 | top: 25%; 70 | } 71 | 72 | .banner-center-left { 73 | top: 25%; 74 | left: 0; 75 | } 76 | 77 | .banner-center-right { 78 | top: 25%; 79 | right: 0; 80 | } 81 | 82 | .banner-top-center { 83 | width: 50%; 84 | left: 25%; 85 | top: 12px; 86 | } 87 | 88 | .banner-bottom-center { 89 | bottom: 12px; 90 | } 91 | 92 | .ath-guidance img { 93 | position: absolute; 94 | bottom: 0; 95 | } 96 | 97 | 98 | @media (min-width: 576px) { 99 | 100 | .banner-dialog-centered { 101 | min-height: calc(100% - 3.5rem); 102 | } 103 | 104 | .ath-banner-cell { 105 | width: 90px; 106 | margin: 3px; 107 | } 108 | 109 | } 110 | 111 | @media(min-width: 768px) { 112 | 113 | .ath-banner-title { 114 | width: calc(100% - 360px); 115 | } 116 | 117 | .ath-banner-cell-2x, 118 | .ath-banner-cell { 119 | width: 120px; 120 | } 121 | 122 | .ath-banner-cell-2x { 123 | width: 160px; 124 | } 125 | 126 | } 127 | 128 | @media (min-width: 992px) { 129 | 130 | .banner-lg { 131 | width: 50%; 132 | } 133 | 134 | .banner-lg-top-center { 135 | left: 25%; 136 | top: 12px; 137 | } 138 | 139 | .banner-lg-bottom-center { 140 | left: 25%; 141 | bottom: 12px; 142 | } 143 | 144 | .banner-bottom-center { 145 | width: 60%; 146 | left: 20%; 147 | } 148 | 149 | .ath-container img { 150 | left: 15%; 151 | } 152 | 153 | } 154 | 155 | 156 | 157 | .edge-wrapper, 158 | .firefox-wrapper, 159 | .samsung-wrapper, 160 | .opera-home-screen-wrapper { 161 | opacity: 0; 162 | } 163 | 164 | .firefox-wrapper, 165 | .samsung-wrapper, 166 | .opera-home-screen-wrapper { 167 | bottom: 21px; 168 | } 169 | 170 | .opera-home-screen-wrapper { 171 | width: 100%; 172 | max-width: 483px; 173 | right: 6px; 174 | left: auto; 175 | } 176 | 177 | .ipad-wrapper img { 178 | position: absolute; 179 | top: 0; 180 | } 181 | 182 | .animated.delay-7s { 183 | animation-delay: 7s; 184 | } 185 | 186 | .overlay-1 { 187 | z-index: 2020; 188 | } 189 | 190 | .overlay-2 { 191 | z-index: 2040; 192 | } 193 | 194 | .overlay { 195 | position: absolute; 196 | top: 0; 197 | bottom: 0; 198 | left: 0; 199 | right: 0; 200 | height: 100%; 201 | width: 100%; 202 | opacity: 0; 203 | transition: .3s ease; 204 | } 205 | 206 | .ath-container p { 207 | margin: 0; 208 | padding: 0; 209 | position: relative; 210 | z-index: 2147483642; 211 | text-shadow: 0 0.1em 0 #fff; 212 | font-size: 1.1em; 213 | } -------------------------------------------------------------------------------- /webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /webfonts/fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fontello.eot -------------------------------------------------------------------------------- /webfonts/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fontello.ttf -------------------------------------------------------------------------------- /webfonts/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fontello.woff -------------------------------------------------------------------------------- /webfonts/fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docluv/add-to-homescreen/bc3a5727f1819dcde25495c55601483cd8b4a5bc/webfonts/fontello.woff2 --------------------------------------------------------------------------------