Look at how LinkedIn does it, but provide a "Download App" button which will redirect to the app store with the app store's knowledge of the user having the app or not. In Android, this will be bypassed since we can look for http: scheme redirects. This will prevent unrealized orphaned web browser windows in the iPhone case, at the expense of more clicks.