Teenagers and children at a computer games fair.
Teenagers and children at a computer games fair.

A landmark law has been passed in California allowing teenagers to erase postings they have made online, in a move designed to prevent youthful internet indiscretions returning in later life to damage their job prospects and blight their reputations.

The bill compels web companies such as Facebook, Twitter and Google to comply with the requests of users to erase material they have posted while under 18, such as offensive comments or embarrassing pictures. It was signed into law by California Governor Jerry Brown after being passed unanimously by the state's Senate, and will come in force in 2015.

The bill is intended to protect "a teenager that says something on the internet that they regret five minutes later," Senator Darrell Steinberg, who introduced the bill told CNN. "Under this bill the websites in California will have to have the ability for the young teenager to remove that."

The bill will also ban companies harvesting data on internet use by under 18s to sell them products such as guns that are banned for juveniles.

Under US law, people can have juvenile criminal records expunged when they turn 18, and campaigners welcomed the bill as necessary for ensuring that young people coming of age in the digital era are not haunted by their online indiscretions.

"Do you ever find yourself worrying that, given the types of things minors deem appropriate to post on social networking webites like Facebook and Twitter, our country won't be able to produce an electable candidate for president in 40 years?" writes Cynthia Larose for the law blog Privacy and Security Matters. With the legislation in place, writes Larose, "many more of our children could become president someday."

Earlier this year 17-year-old Paris Brown, a youth crime commissioner with Kent Police in the UK, was forced to resign her position after Tweets after offensive tweets she had made when younger came to light, in which she boasted of drinking and drug use.

In the US, teenagers have been arrested and expelled from school for material they posted online.

Some critics though argue that the legislation is too restricted, and does not compel companies to erase the information from their servers or compel them to take down information posted by third parties.

The Center for Democracy and Technology, on the other hand, warned that the legislation could restrict teenagers' access to the internet, as other states introduce their own laws on juveniles' internet use.

"We are principally concerned that this legal uncertainty for website operators will discourage them from developing content and services tailored to younger users, and will lead popular sites and services that may appeal to minors to prohibit minors from using their services," the group said in a letter to lawmakers.