Detecting installed apps on iPhone with javascript or url - iphone

I am building a HTML5 based mobile web app for iPhone. I need to check whether user has specific application that I suggest. I heard that each iPhone application has unique URL scheme to detect their app indentity.
Therefore, I've read this article to get an idea.
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
However, this is not perfect answer to make what I am trying to make.
here is what might happen
User clicks a recommendation app on mobile web browser.
Check with application iTunes URL and URL scheme.
If the user has the installed application, it returns 'installed'
==> In this case, the screen returns back to mobile browser.
If the user does not have the installed application, it returns 'uninstalled'
==> In this case, the screen moves to App Store.
I am running mobile web app with PHP language.
Thank you.

this is not possible I'm afraid. To be honest I'm glad, as there are real privacy concerns if any old web page can detect which apps I have installed.
That's definitely not a good thing!
UPDATE: If you're happy to go native, this library will do what you want.. http://www.cocoacontrols.com/platforms/ios/controls/ihasapp

If you know that a url scheme for the app exists then you can open it via a web link like this, "myapp://". With this there are some round about ways you can effectively check if a certain app exists.
See this related stackoverflow post

Related

Determining kind of facebook app

https://apps.facebook.com/horoscopes/?fb_source=search
Can anyone tell me what kind of facebook app it is? canvas or something else?
I would want to create an app in php but have no clue where to start from. Can i create a test app and start the process? please help.
I have tried creating an app but that needs to be approved before even starting the development and showing us as a page on facebook app
Any app with an address of apps.facebook.com/* is the Canvas link to the App, which means this app has a canvas page at the minimum. It may also have a website and mobile app associated with it, but that's harder to determine.
You should so some research before trying to create an app. You do not need to get any sort of approval to develop an application, even if you use excessive permissions. However, you will need to get your app approved for any extra permissions prior to launching to end-users.
You should visit the Facebook Developer website and pick a SDK you're comfortable with. I would recommend using the JavaScript one to get started, but the choice is yours. Then you should follow the starter guide to creating your first app. Everything you need to create an app is discoverable through Google, and I have a few handy tutorials on my site for using the PHP and JavaScript SDKs.

How to launch iOS app via custom URL and allow to open a webpage if it's not installed?

I'd like to be able to send invitation in an email to a specific "event" happening inside my iOS app. So I figured I'd need to use custom URL. That's fine.
But I'd also like to be able to handle the user that doesn't have the app installed yet, to be taken to a mobile Safari and to the webpage with installation instructions for the app.
What would be the best way to do it?
I could try the following:
In the email I send a link to a http://www.example.com/joinevent/?id=foo
User is taken to a Safari webpage that sends a redirect to mycustomscheme://joinevent/?id=foo
If the user doesn't have the app installed this redirection won't work and he stays in the Safari - I could then handle the displaying of installation instructions probably.
But this approach doesn't seem "natural" for me. Is there a better/more native way to do it?
Try http://rdrct.it
It is a web service that allows you to achieve exactly this functionality very easily.
Full disclosure - I created rdrct.it
Here's the basics:
Login to the site, create a project for your particular app. Choose a unique code (this could be the name of your app).
You'll then be provided with a URL in the form: http://rdrct.it/uniqueCode
Once you've done that, you need to register the app's ID in the app store, and also details about the custom URL scheme. Tick "Auto-redirect" - what it will then do is try to open the app, and if that fails, it will automatically send the user to the app store.
If the app is opened, then the querystring is also passed to the app, so in your example case, the device will have been served: mycustomscheme://joinevent/?id=foo
It also works across multiple device types, so if you have the app available for Blackberry, Android or Windows Phone, then it will also do the same for those depending on which device type the user is using.
Like I said, I created it, but it should solve your problem.
If you are using Distimo to track you app analytics, they provide a shortlink to your apps that can be used also used to track conversions. It shows a custom page depending on the device used to access. This is especially convenient if you have the same app published in the AppStore, Google Play, Amazon, etc.

Can Facebook's "Single Sign On" be achieved within a mobile web app?

It's my first posting on here (although I've been using this site for reference for quite some time).
I've been trying for several days now to find or dream up a way to use Facebook's "Single Sign On" from within a mobile web app (not a native iOS or Android app) to automatically sign a user into a web app if they are already logged into Facebook from the native Facebook app on their mobile device for example.
My limited knowledge is telling me that it can't be done since the mobile browser and the 'system' (iOS for example) are too separated (I can't, I don't think, have my mobile web app use or access the native Facebook app on a mobile device in any way).
I have found and read the iOS, Android AND Mobile documentation provided by Facebook (https://developers.facebook.com/docs/guides/mobile/) which all seems to make enough sense, but after days of trawling through everything else I could find on the subject there doesn't seem to be a way to use, for example, the Facebook app on an iPhone or Android device to automatically log a user in to my web app if he/she is already logged into Facebook.
I've read lots about doing this from within 3rd party native apps and also other people trying to achieve a similar thing from within Desktop apps but I'm trying and hoping to be able to achieve this from a web app running within a mobile web browser.
I'd be very grateful for any help, opinions or pointers in the right direction since I think this would be an excellent step forward in UI for mobile web apps to have (not just the native apps).
Many thanks in advance...
Probably a bit late to the party but in case anyone else is wondering yes it's possible with Cordova/Phonegap and the Facebook Connect Plugin: https://github.com/davejohnson/phonegap-plugin-facebook-connect/
Using the FB.getLoginStatus() method at startup allows to check if the user is already signed in with the native Facebook App and retrieve its profile. More details in the examples provided in the repo.
I have not yet implemented it myself, but seems possible according to:
http://developers.facebook.com/docs/mobile/web/build/#login

How can I add a link to an iPhone native app from website IF POSSIBLE

I have a link to a Facebook page from a website. I know I can use the URL scheme href="fb://" to open up the Facebook application from within an iPhone, but if the iPhone user does not have the native application installed, an ugly error message pops up. I would rather just send this user to the Facebook website.
There's gotta be a way to do this, but everything I've tried has had some short-coming:
Can't make a HEAD request to a different server
Can't run a try catch javascript function since the event leaves the client page
Can't seem to access information about the user's applications... or can I? I've read a bit about a cookie called "appInstalled" but can't find any real documentation about it.
Any ideas out there? Thanks a ton in advance.
Denis
Can a website determine if a device [iPhone] has certain applications installed ? I'm pretty sure that's a big NO because of privacy and security concerns.
Not a really technical answer, but you could change the user interface to give the user an option. For example, having:
Click here if you have the facebook application installed on your iPhone.
If you do not, click here to go through to the site.
Sorry that I cannot offer a "proper" solution, I'm not really that familiar with iPhone development.

iPhone: Pass information from web page to app that's downloaded from App Store

I'm trying to glue information from a web page to an iPhone app that said web page suggests to download. I control both the web page and the downloadable app.
Scenario is like this:
User visits my web page, on which I recognize the user (he may have logged in, and I store his info in a cookie). I then present a link to him to an app in the App Store that he should download for "enhanced experience" of this web service of mine.
Now, when the user launches the downloaded app on his iPhone, I like to re-identify the user who previously visited said web page.
All would be easy if an iPhone app could read Safari's cookies. But it can't.
A somewhat lame solution could be that the web server stores the visitor's IP address and uses that to recognize him once he launches the iPhone app. But that's not reliable.
Another one would be to give the user a token (code) that he needs to remember and then re-enter in the app. Still quite awkward, I think.
Any better suggestions?
Simply put, you can't do this.
One thing you could consider is a custom URL scheme to launch the app. You could send the user an email that uses this custom link. However there's a couple of problems with this:
the user may not have the account that they used to register for your site set up on their iPhone. This might seem unlikely, but say the user signed up for your site 5 years ago with their Hotmail account and they have since switched to Gmail.
it's unlikely that the email would fit into their workflow. They would probably download the app and just launch it by touching the icon instead of clicking a link in a received email.
You could also put the custom URL as a link on your web page, but again, this won't fit into the workflow because they have to go to the App Store app to do the download.
Consider this - if you've got some sort of website that has an authentication step, it's probably a fair bet to say that the user is the type of person who already has an application such as Facebook installed on their iPhone. They are already used to the paradigm of having to enter their credentials into an application despite the fact that they may have already done it in Safari.
If you could read the unique iPhone device ID from javascript on your web page, you could look for that again when the application connected...
But I cannot find any means of reading this from Javascript in Mobile Safari, I thought I'd post in case there is a way now to give you another option to consider.
OK, we found a somewhat working solution: The html code can create a cookie. Later, when the app runs, it can't directly read that cookie, of course (due to the sandboxing of iPhone apps). However, it can connect to the server, then open a http URL pointing to the server and including a unique token that it has gotten from the server beforehand. This leads to launching Safari, accessing the server. The server can now read the aforementioned cookie and finally establish the connection with the help of the token.
Just stumbled over this question and I'm curious if you thought about using a UIWebView.
Where the question is - does UIWebView share cookies with safari?
If it does the rest should be easy.
UIWebView's DON'T share cookies with Safari. So unfortunately that is not an option.