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

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.

Related

What's the correct way to authorize PhoneGap application to the Facebook?

I spent a while already to fix annoying issue with Facebook in PhoneGap app. And still a lot of things goes wrong with that. The thing is that I use Appery.io and Facebook plugin.
This is how my Facebook console looks now:
I suggest that localhost might be a reason of the issue. However, I got it into Facebook_Helper.js:
Everytime I try to sign in with FB account, I get the same error at the child window:
So what I've got is that app is authorized at this moment indeed, because there's a menu button at the navbar that allows me to navigate through FB profile:
The first issue lies in that the child window never gets closed automatically once user submitted Sign In form. And the second one is that I can't get the access token to the app directly. I know I'm doing something wrong, but I spend more than a week on that and nothing was clarified.
Honestly, I've no idea why it's not working. I saw a lot of apps written in PhoneGap that use the same authorization too, and they work as it should. Will be appreciate if you take a look into that and, maybe, advice something.
First, I don't see iOS or Android in your developer.facebook screenshot.
Second, you should implement native facebook integration if you are developing an app, if I understand correctly from your code, you are trying to handle only web browser version of authentication. Native integration is both the suggested way by facebook and platforms and better experience for end users. If users have facebook app installed, authenticating over fb app is more secure after all..
You can use a cordova plugin for facebook integration, here is one of the plugins (I am one of the authors): cordova-facebook plugin

Detecting installed apps on iPhone with javascript or url

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

How does the browser plugin Disconnect work?

I've recently installed the browser plugin Disconnect to keep Facebook, Twitter and Google from recording my browser history as I use the regular web while still letting me use those services when I choose to.
Can anyone explain how Disconnect works?
I'm interested in how it works to understand where my web experience might be changed or compromised and as an intellectual curiosity about what these sites are doing and how it can be blocked.
There are detailed descriptions of what our extensions do in the extension galleries (and someday soon, our site), e.g.:
https://chrome.google.com/webstore/detail/jeoacafpbcihiomhlakheieifhpjdfeo
More technically, all our extension code is open source (and well commented and otherwise readable, if I do say so myself):
https://github.com/disconnectme
I'm only guessing, but to track you, google, facebook and twitter send you a cookie to identify you. Then if you browse the web a display page that contain an adsense banner, a g+1 button an analytic script, a facebook/twitter widget, google , facebook and tweeter access this cookie.
So to prevent them to record your browsing, maybe the addon filter the cookie sent in http request or filter google/fb/twitter script/iframe/url from the viewed page.
Hope this could give you a hint.
Regards

Twitter OAuth Login Page on the iPhone

I have Twitter integrated into my application, with the help of Sharekit. Everything works pretty well except, if the user happens to tap on the "Sign Up" link on the Login/allow page, it goes to a non-sign up error page. Either a "Sorry that page doesn't exist" or "Hold up! Sorry the profile you were trying to view was suspended due to strange activity."
The account I'm using is working as far as logging in, posting etc. But that link seems to go off into space. Also if I click on the "Twitter Gear"/Application Icon the dialog (web view with the Twitter OAuth Authorize page loaded) just closes.
I can't find anything about how to configure stuff like this and everything else seemed to work pretty easily. The closest reference I could find was,this link Twitter API Issue 1045
Thanks in Advance for any help
Update:
I've been checking a few other apps with Twitter support. Most of the ones I've checked (TUAW,Joystiq,TFLN) seem to have rolled their own Twitter Login Page (using XAuth I assume) the one I found that uses the Twitter OAuth page (Shazam) actually takes you to mobile Safari and it exhibits the same behavior. Maybe I need to roll my own login?
I suggest you go into the ShareKit class files, go to the two .m files that have "twitter authorization" (im not sure which of the two it is, a simple search on xcode should find it) and change the invalid url that it is being sent to to this URL: https://mobile.twitter.com/signup
That should fix your problem!
I suggest using a packet sniffer on your device to determine the exact URL being called when you click the "Sign Up" link. There are plenty of ways to do this, but it is easier on jailbroken phones. Armed with the URL, you can see if it is potentially something you are doing wrong or indeed a twitter bug.
Try Jan Rain it makes it easy to integrate this functionality without errors.
http://www.janrain.com/products/engage/mobile
Here is a ShareKit folk I am using: https://github.com/baotuo/ShareKit
It looks do not have your issues and have much more improvement. You should give it a try.
When you implement twitter integration, you should not use the library which you used in older projects but download new twitter library. I had some problems with twitter oauth when I used older library. But after download and use new library, the issue was fixed.

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.