40media How do I detect, via javascript in Safari Mobile, if my iPhone application is installed?

How do I detect, via javascript in Safari Mobile, if my iPhone application is installed?

As you probably know, iPhone applications can register a custom URL scheme handler, ala "myapp:" and these can be used for links in a page viewed in Safari.

I'd like to automatically launch my application from a specific page if the visitor has the app installed. If the app's not installed, I'll just show them the current mobile-optimized view of the page.

How can I do this detection? Google searches have been fruitless. Also, to be tricky, I've tried doing something like this to no avail:

var image = new Image(); image.onerror = function(e){   alert("bummer"); } image.onload = function(e){   alert('success!'); } image.src = 'myapp://something=meaningful'; 

Has anyone come across a way to do application detection?

Where's the difference between setObject:forKey: and setValue:forKey: in NSMutableDictionary?


Why is my UIImageView blurred?
The solution I've presented on ananother Stack Overflow question is around as close as you're going to receive .. SHowing Activity Indicator View Using Thread Shows This Error in gdb?
Unable to push notifications to iPhone in .NET - .PEM certificate problem?What's the difference between using obj-c accessors and using dot syntax?


UIWebView scrollBy replacement
I don't think this is possible. Hide the tab bar when displaying the ABPeoplePickerNavigationController?You would need to register your app on the iPhone/Mobile Safari and then create a uri to fire your app up, just like http:, ftp: mailto:. Draw a shadow behind UIWebViewSo in your case you would have any thing like Am I installed Mobile Safari would need to know what app to fire up to load this URI and I just don't think this functionality is built into the iPhone. I know there is no way javascript must query your iPhone to see what's installed.. I hope I am wrong as this seems like it would be a powerful feature, though on the another side I must see any security issues related to any thing like this.. Good luck..

80 out of 100 based on 55 user ratings 290 reviews