It's actually tied to meta tags and the manifest.json. If you have the correct tags, Safari automatically shows the prompt if you don't have the app installed or the open with button to open in the already installed application.
For Chrome (desktop or mobile), if you have similar attributes in your manifest.json, then Chrome will show the 'Install' button to install the webapp to your home screen.
For Chrome (desktop or mobile), if you have similar attributes in your manifest.json, then Chrome will show the 'Install' button to install the webapp to your home screen.