It's a nightmare since each browser/device handles it differently.
Favicon generator helps me a lot for those applications where we need to cover the most possible scenarios.
https://realfavicongenerator.net/
You just need a png image 260px x 260px (at least) and from there the generator will create all references you need within your web page.
You just need to add this references and images to your application.