A division bench of Acting Chief Justice B.D. Ahmed and Justice Vibhu Bakhru also directed the two companies to display on their websites the name and contact details of their grievance officers.
"We direct Google Inc and Facebook Inc to display the name of grievance officer on their respective sites. We also direct other intermediaries that the compliance (of the rules) be done in two weeks," the court said.
It said the Information Technology (Intermediaries) Rules mandate that all social networking sites have to publish the name of grievance officer and their contact details.
"Just because you are a foreign company, you cannot flout the law. Like us, you are bound by the rule of law of this country," said the court, also asking the central government to take steps to ensure that the social networking sites comply with the rules.
The bench also asked the central government to file its response on the allegations of petitioner that Delhi Police, Indian Railways and others have created accounts on social networking sites despite government departments being barred from doing so under the law.
The petitioner submitted that government departments like Delhi Police and the Indian Railways are not entitled to create accounts on social networking sites.
The court was hearing the PIL filed by former Bharatiya Janata Party (BJP) leader K.N. Govindacharya through his advocate Virag Gupta alleging that the websites have no mechanism for protection of children from online abuse.
The PIL has said that children below 18 years are entering an agreement with the social networking sites to open accounts which is against the Indian Majority Act, the Indian Contract Act and also the Information and Technology Act.
The plea has also sought recovery of taxes from the websites on their income from operations in India.