views:

59

answers:

2

Is there any safe way to detect, on a web page, client side (JS), whether user has an Google/Yahoo/Live/? account?

I know about some suspicious ways to do this by styling visited links and then sneaking on computed style attribute, but it's more of a hack, Mozilla and maybe other are planning to crack down on this, as it might be abused.

But I need this to allow users more integration with their identity providers, like:

  • Have a Google account? ~> load contacts for sharing from Google Contacts API
  • Have an Yahoo account? ~> load contacts for sharing from Yahoo Contacts API
  • none of the above? show no link

I don't want to provide all these options to all visitors, would be nice if I can detect the account, and provide integration only in that case.

+1  A: 

The only valid way to do that is by using Google and Yahoo API's which are easy to implement. User will have to either provide his login details on your site or to use token methods which redirect login to Google/Yahoo and then back to your site. Once you connect to API, you can do anything with user account.

eugeneK
+3  A: 

Yes, you ask them. Despite your misgivings, people will be far happier with you if you bother them, asking for the information, than they will be if you 'steal' such information.

You only have to re-read your question with phrases like "sneaking", "more of a hack", "planning to crack down", and "might be abused" to realise what a bad idea this is - maybe you could scan their hard disk looking for bank account information while you're at it :-)

paxdiablo
You are certainly right, it was a bad idea.
skrat