In the recent past, I had a friend who suffered a loss in their family. Obviously I'm not going into details here, but when giving my condolences and getting notifications for other condolences I scrolled through many that had the question "What happened?" I cringed as I read this. Obviously my friend never answered.
Friends, it is never okay to ask what happened online. If you're not close enough to the family to already know then you cannot ask. Always assume that if the family wanted to share how their loved one has passed away that they would post that when they make the initial post online or even in a follow up post. But it is very rude to ask "What happened?" If they wanted you to know, they would have said how.
If you're not close enough to already know how their loved one has passed away but you are somewhat close to that person, you can always ask through a private message, phone call, or text but even that is pushing it. You risk venturing into the territory of looking nosy instead of offering condolences. The most important thing is that you are there for your friend, not finding out the details.
While I'm on the topic of what not to do, I will also add that you should never post online when you find out someone has passed away. Say you're talking to your Aunt Sally and she tells you that the Smith family lost their grandmother. DO NOT immediately go to the wall of the Smith family member that you're friends with and post a condolence. DO NOT immediately go to your own wall and post about the loss. There may be other family members that do not know yet, and you just happen to know because Aunt Sally was closer to a certain family member. You want to give them time to notify everyone. Nothing is worse than finding out online that someone you loved passed away.
Say Cousin Smith was not able to answer their phone when they initially tried to notify her, maybe she was at work and would just return the call after she got home. During a break she got a second to scroll through Facebook and sees your post about her grandmother passing away. Should she have heard it from you on Facebook or from a loved one over the phone? You've taken an already devastating situation and made it a million times worst for that person. Your heart might be in the right place but you have to follow this new set of protocol.
Always go by the rule that you do not post until they post. When the closest family member posts online about their loss, you can assume that the family has been notified and you are able to say something at that point. And for the love of Pete...DO NOT ASK WHAT HAPPENED?!