MozillaZine


How To Add More Than One Policy?

User Help for Mozilla Firefox
billnotben
 
Posts: 21
Joined: March 14th, 2009, 10:31 am

Post Posted September 21st, 2021, 9:15 am

It's simple enough to add a policy but how do you add more than one?

morat
 
Posts: 4754
Joined: February 3rd, 2009, 6:29 pm

Post Posted September 21st, 2021, 11:26 am

Do you mean adding multiple policies using the policies.json file?

Example:

Code: Select all
{
  "policies": {
    "DontCheckDefaultBrowser": true,
    "Homepage": {
      "StartPage": "homepage",
      "URL": "https://www.google.com/"
    },
    "NewTabPage": true
  }
}

More info: viewtopic.php?f=7&t=3057471
Last edited by morat on September 21st, 2021, 10:25 pm, edited 1 time in total.

jscher2000

User avatar
 
Posts: 11439
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted September 21st, 2021, 12:04 pm

The policies.json file uses JSON notation: https://www.w3schools.com/js/js_json_syntax.asp

In JSON, different properties of the object are separated by commas. These properties can themselves be objects. As an example that includes multiple policies, some of which are objects and some of which are just values, see:

https://github.com/mozilla/policy-templates/blob/master/README.md#policiesjson-3

billnotben
 
Posts: 21
Joined: March 14th, 2009, 10:31 am

Post Posted September 21st, 2021, 3:54 pm

Thank you both.
You've given me something to scratch my head over.

dickvl

User avatar
 
Posts: 53516
Joined: July 18th, 2005, 3:25 am

Post Posted September 23rd, 2021, 3:59 am

You can separate multiple policy rules by a comma.
There shouldn't be a comma directly before a closing bracket (}).
You can open a JSON file in a Firefox tab to let the built-in JSON viewer validate and display the file.

billnotben
 
Posts: 21
Joined: March 14th, 2009, 10:31 am

Post Posted September 25th, 2021, 3:24 pm

Thanks, that's something else I didn't know.

Return to Firefox Support


Who is online

Users browsing this forum: Google Adsense [Bot] and 2 guests