Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

Learn More

String format in about:config for Top Sites with labels

more options

I would like to pin some sites to Top Sites via mozilla.cfg. I have mozilla.cfg file, every changes and modifications works as expected, but after adding browser.newtabpage.pinned string copied from about:config, loading of mozilla.cfg end up with syntax error. The line in mozilla.cfg looks like this:

lockPref("browser.newtabpage.pinned", "[{"url":"https://1.site1.de/","label":"S1","baseDomain":"site1.de"},{"url":"https://2.site2.com/","label":"S2","baseDomain":"site2.com"},{"url":"https://3.site3.fr/index.pl","label":"S3"}]");

I don't know, where to add quotes and where/which brackets.

I would like to pin some sites to Top Sites via mozilla.cfg. I have mozilla.cfg file, every changes and modifications works as expected, but after adding browser.newtabpage.pinned string copied from about:config, loading of mozilla.cfg end up with syntax error. The line in mozilla.cfg looks like this: lockPref("browser.newtabpage.pinned", "[{"url":"https://1.site1.de/","label":"S1","baseDomain":"site1.de"},{"url":"https://2.site2.com/","label":"S2","baseDomain":"site2.com"},{"url":"https://3.site3.fr/index.pl","label":"S3"}]"); I don't know, where to add quotes and where/which brackets.

Solution choisie

This issue is because you are enclosing quotes inside of quotes. Firefox doesn't know where one quote begins and the other ends.

For example, in the code that you have provided, Firefox sees "[{" as one quote and ":" as the second thing side of the quotes.

Instead, you will went to enclose the second part of the lockPref with a single quote ( ' ) instead. This way Firefox will open up the quote and assume that everything after that quote a string until it sees the next ' in your code.

Basically, your code should be, instead:

lockPref("browser.newtabpage.pinned", '[{"url":"https://1.site1.de/","label":"S1","baseDomain":"site1.de"},{"url":"https://2.site2.com/","label":"S2","baseDomain":"site2.com"},{"url":"https://3.site3.fr/index.pl","label":"S3"}]');

Hope this helps.

Lire cette réponse dans son contexte 👍 1

Toutes les réponses (3)

more options

Solution choisie

This issue is because you are enclosing quotes inside of quotes. Firefox doesn't know where one quote begins and the other ends.

For example, in the code that you have provided, Firefox sees "[{" as one quote and ":" as the second thing side of the quotes.

Instead, you will went to enclose the second part of the lockPref with a single quote ( ' ) instead. This way Firefox will open up the quote and assume that everything after that quote a string until it sees the next ' in your code.

Basically, your code should be, instead:

lockPref("browser.newtabpage.pinned", '[{"url":"https://1.site1.de/","label":"S1","baseDomain":"site1.de"},{"url":"https://2.site2.com/","label":"S2","baseDomain":"site2.com"},{"url":"https://3.site3.fr/index.pl","label":"S3"}]');

Hope this helps.

more options

You need to escape all quotes inside the JSON string (\").

lockPref("browser.newtabpage.pinned", "[{\"url\":\"https://1.site1.de/\",\"label\":\"S1\",\"baseDomain\":\"site1.de\"},{\"url\":\"https://2.site2.com/\",\"label\":\"S2\",\"baseDomain\":\"site2.com\"},{\"url\":\"https://3.site3.fr/index.pl\",\"label\":\"S3\"}]");
more options

(Deleted duplicate suggestion)

Modifié le par jscher2000 - Support Volunteer