Sometimes, you might want to be offline and check who are all online on Google+ or Facebook. You may have some reasons to do this, I'm going to show you how to do this stuff perfectly. It will be something like the list of online people will be showed, you can choose whether you must be showed online or offline to them, it's completely your choice.
UPDATE on 17/09/2021: Pidgin will no longer work for Facebook as Facebook disabled its XMPP Chat API from April 30th, 2021.
You will need a third party application named, 'Pidgin' to do this. The best part is Pidgin is available for Windows, Mac and Linux. Download Pidgin. For complete guidance on which version you have to download and how Check this link.
You may ask me, 'Why should we use a third party application while there are provisions to do this on Facebook and Google+ by default'.
Good question. Here my answer, you may turn off chat on Facebook and Sign out from hangouts on G+. But, you will no longer see the online friends in both the cases. But this method will help you check the online contacts.
Also see: 10 Facebook tips you might not know about.
First of all you have to configure your accounts on Pidgin - How to setup G+ and Facebook account on Pidgin.
Now, open Pidgin. You could see a window similar to the one showed below.
Check the bottom of the window. You will see the option 'Available' selected. Just click on it and change it to 'Extended away'. That's it, from now on you will be shown offline to all of your friends at the same time you can check who are all online until you change the status from Extended away to something else.
Note: When you use Facebook on your mobile, you can put chat off at the same time check who are all online. But still, your presence on Facebook will be showed to all of your friends who use Facebook using mobile as 'Active Now'. Same is the case when you turn off chat in desktop. This trick eliminates this risk.
Do you know, anyone of your friends can check your activity on Facebook by simply visiting m.facebook.com, even if you have turned off chat for them. Then, they will come to know that you have deliberately turned off chat for them. This may impart a bad impression about you.
Sometimes, you may want to chat with some of your friends and avoid some group of people without getting caught by them. Here Pidgin comes for the rescue, you must keep the status as 'Extended away' and keep chatting with the one you want.
Now, if the people you want to avoid check messages using mobile or m.facebook.com, your activity won't be showed as 'Active Now'. So, problem solved.