Image copyright Reuters Image caption Joanne Frail admitted contacting a defendant via Facebook and was jailed for eight months

Is your last post on Facebook going to land you in jail?

It might do if it ruins a criminal trial. And the government is now looking for evidence of whether new laws are needed to stop it happening.

The Attorney General, the government's top law officer, is asking judges, police and victims' groups for examples of where posts, chat and tweets have compromised a trial.

So how can a post on social media cause such damage? And what can you do to protect yourself? Well, it's all down to whether you say something that would influence a jury.

Seven ways to avoid affecting a criminal case and to stay out of jail:

If you have a friend on a jury, don't message them on Facebook asking about their case - they're not allowed to tell you. In fact don't approach jurors at all. Don't post messages saying you know the defendant in a case definitely did it. Everyone is presumed innocent until proven guilty. In fact, don't comment on the character of defendants, victims or any witnesses. If you're on a jury, don't look up the history of the case. Don't contact the defendant on Facebook to tell them you're on their side. Ask yourself whether any of your actions on social media could influence a case. Journalists know the limits and get professional legal advice. If we're not doing it, there's a good reason why.

Jurors receive robust warnings to ignore reports outside of the courtroom - and judges have to trust them to impartially hear the evidence. But in our law, there still comes a point where comment can become criminal. It's called contempt of court.

A journalist reporting a murder trial would be in serious trouble if he or she blurted out that the defendant had in fact killed before - a fact that has been kept from the jury to ensure they return a verdict uninfluenced by past events.

The judge would have to decide whether any juror who had heard the report would have been so swayed as to be incapable of assessing the evidence presented in court.

The reporter might want to think about packing their toothbrush: they could be going to prison.

Such events are very, very rare. Journalists are trained how to avoid spending time at Her Majesty's Pleasure.

But social media is changing everything. Everyone is still subject to the same rules - but the problem is that very few people outside of the law and media have a clue about contempt of court unless they've been involved in a trial.

At the same time, almost everyone has got an opinion. And if you post it on social media, an awful lot of people are going to read it.

And that's why, two years ago, a judge stopped a major murder trial.

Two teenage girls had been accused of murdering Angela Wrightson, a vulnerable woman from Hartlepool. As the July 2015 trial started at Teesside Crown Court, local and national media reported in accordance with the law - fairly and accurately.

Image copyright Cleveland Police/Reuters Image caption The Angela Wrightson case raised novel and important legal issues regarding the use of social media

Then Facebook posters weighed in.

Before the second day was out, there were more than 500 comments linked to news reports on the network. Some threatened the accused, others scoffed at their pleas of innocence and others attacked the court process itself.

Mr Justice Globe could not be sure that a local jury, hearing one of the most controversial cases for years, could avoid being influenced. The trial was scrapped and moved at great expense to Leeds in the hope of finding a jury who would not be exposed to the inflammatory comments on Facebook.

And six more tips to keep you out of the cells:

If a defendant isn't named in a court report, there's a legal reason why. If you know who the defendant is - don't name them just because you're annoyed we haven't. Don't name victims in sexual offence cases - it's against the law. Don't name children who are on trial - that's also illegal, other than in exceptional circumstances. If you are in court don't take photos. Or record videos or sound. If you overhear a private conversation in a court building relevant to a case, don't repeat it online. If you're a juror, don't talk about your case with family and friends.

This Wrightson case is the most dramatic example to date - but it's not the first time that social media has disrupted the trial process. Six years ago, I reported on the first ever case of a juror being convicted for contacting a defendant on Facebook. She was jailed for eight months.

More recently, we've seen examples of social media posters ignoring the law that protects the identity of certain victims.

When footballer Ched Evans was charged with rape (he was found not guilty at a retrial), 10 people posted the name of his accuser online.

This is a crime because alleged victims of sexual offences are granted lifelong anonymity. All the posters were given a police caution.

So the Attorney General's review will also look at examples like this or the breaching of other reporting restrictions.

The Attorney General's appeal for information runs until December.

It could lead to tougher laws if the problem looks like it is really serious. Or it could also raise a more fundamental question: given other countries like the US get by without a similar law prohibiting comment during trials, is contempt of court still workable in the age of social media?