title: How can I detect if an app is installed on an android device from within a web page
body: <p>Here is the situation:</p>
  
  <p>I have a web page that needs to check through JavaScript if my app is already installed on the android device it is currently running on.</p>
  
  <p>If the app is installed the page will show a link (with custom protocol) to launch the app,
  otherwise the page should show a link to the android market.</p>
  
  <p>I can manage the links to app and to market. The only remaining step is to detect the presence of the app on the device from within JavaScript code (or perhaps try to catch a possible error of unsupported protocol as an indication of not existing app).</p>
  
  <p>When I</p>
  
  <ol>
  <li>click on a web link with</li>
  <li>my custom app protocol and</li>
  <li>the app is not yet installed on the device</li>
  </ol>
  
  <p>I can see that the android environment generates an "protocol is not supported" type error.
  Unfortunately, I am not able to capture that error in the JavaScript code to divert the user to the android market.</p>
  
  <p>I guess both direct detection and error detection are valid methods if they exist at all.</p>
  
  <p>Any ideas how can I accomplish that?</p>
  
  <p>Thanks for help.</p>