By Alex Dobuzinskis

LOS ANGELES (Reuters) - Many actors think there ought to be a law against posting their ages online, and California this year obliged critics of ageism in Hollywood by passing a law targeting a leading movie and television information website.

The law has been challenged in a lawsuit by the company IMDb, which is owned by Amazon.com Inc and operates a repository of information on the film and television industry.

The lawsuit, filed on Thursday in federal court for the Northern District of California, alleges that the measure violates free speech rights under the U.S. Constitution.

Supporters described the law as an effort to prevent age discrimination. It requires officials at IMDb.com to remove from the website the ages of figures in the entertainment industry, including actors and directors, if those individuals request the deletion.

Actors in Hollywood have long complained they are passed over for roles as they get older.

Female performers in particular say a double standard gives women fewer opportunities as they age, while men can still land leading parts late in their careers.

"By the time you're 28 you're expired, you're playing mommy roles," actress Zoe Saldana, now 38 and female lead of the blockbuster film "Guardians of the Galaxy," told The Telegraph in 2014.

The lawsuit said the law, known as AB 1687, was unfair because it was carefully tailored to apply only to IMDb.com Inc, which is incorporated in Delaware and has offices in Seattle, and not other sources of information.

"IMDb shares the worthy goal of preventing age discrimination," the lawsuit stated. "But AB 1687 is an unconstitutional law that does not advance, much less achieve, that goal."

The lawsuit seeks a court judgment blocking enforcement of the law. It names California Attorney General Kamala Harris as a defendant.

A spokeswoman for the attorney general's office said in an email lawyers there were reviewing the complaint.

"While age information for Hollywood's biggest stars is readily available from other online sources, this bill is aimed at protecting lesser known actors and actresses competing for smaller roles," state Assembly Majority Leader Ian Calderon, a Democrat who authored the bill, said in a statement in September when the governor signed it into law.

In 2013, a Seattle jury ruled in favor of IMDb in an age discrimination lawsuit by actress Huong Hoang, known as Junie Hoang, who did not want her age listed, according to media reports at the time.

(Reporting by Alex Dobuzinskis; Editing by David Gregorio)