How can we add an Icon for Home Screen in HTML5 when we browse a webpage in chrome app and in option we choose Add To Home Screen. then theres an Icon Shortcut placed on your Home Screen.
I used:
<link rel="apple-touch-icon-precomposed" href="...\icon.png">
<link rel="apple-touch-icon" href="...\icon.png">
nothing happens it display again a default icon.! Just Like the AmStalker Home Screen Icon
What is the best way to do it?
First of all I want to show project structure in image below . I have made a public folder and all the file is inside the folder . And the manifest file is out of public folder .this is image
After That we will create Manifest file code of file is given below.
Manifest.json
// After that we will add service worker
service-worker.js
// Now go to index.html and put the following code in head section
// After that you need to put following code before body closing
Now Run your project and wait for few minute and reload your page and ENJOY !
In your href you have an extra dot i think, and it should be a forward slash not a backslash. try
"../icon.png"
Also Android using apple icon references have been depreciated so these would not work - FOR ANDROID. Please look at https://developer.chrome.com/multidevice/android/installtohomescreen for more information.
The cited source recommends you do this:
<link rel="icon" sizes="192x192" href="../icon.png">
Of course with this method I advise that your image is 192x192 in size.
The modern way is to make it a
Progressive Web App
and the browser will offer this on its behalf.Here - https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/ - you can see the criteria and check for yourself if you've met them.