Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Learn More

Questa discussione è archiviata. Inserire una nuova richiesta se occorre aiuto.

Using an autoconfig file to create bookmarks

  • 3 risposte
  • 1 ha questo problema
  • 33 visualizzazioni
  • Ultima risposta di eddythorn

more options

I'm using an example provided by Mike Kaply to modify my autoconfig file to add bookmarks to users profiles. However, every time I launch FF, instead of the bookmarks being overwritten, I get an extra set. So, after 5 re-launches, I have 5 sets of the bookmarks I'm adding. Is there a way to prevent this? Here is the code I'm using: //Add bookmarks Components.utils.import("resource://gre/modules/Services.jsm"); var uri = Services.io.newURI("http://mike.kaply.com", null, null); var navBook = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService); //create new Folder var FolderId = navBook.createFolder(navBook.bookmarksMenuFolder, "New Folder", 0); //add bookmark to newly created folder navBook.insertBookmark(SCCCFolderId, uri, -1, "Mike's Blog");

I'm using an example provided by Mike Kaply to modify my autoconfig file to add bookmarks to users profiles. However, every time I launch FF, instead of the bookmarks being overwritten, I get an extra set. So, after 5 re-launches, I have 5 sets of the bookmarks I'm adding. Is there a way to prevent this? Here is the code I'm using: //Add bookmarks Components.utils.import("resource://gre/modules/Services.jsm"); var uri = Services.io.newURI("http://mike.kaply.com", null, null); var navBook = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService); //create new Folder var FolderId = navBook.createFolder(navBook.bookmarksMenuFolder, "New Folder", 0); //add bookmark to newly created folder navBook.insertBookmark(SCCCFolderId, uri, -1, "Mike's Blog");

Modificato da eddythorn il

Soluzione scelta

In the end, I had to write code using a for loop with an if/then statement to look for an existing bookmark. Obviously it's a little more complicated than this. It wasn't easy, but I'm able to do what I need to.

Leggere questa risposta nel contesto 👍 0

Tutte le risposte (3)

more options
more options

My understanding is that the distribution file is only implemented for new profiles - that it isn't read for existing users. Is this true?

more options

Soluzione scelta

In the end, I had to write code using a for loop with an if/then statement to look for an existing bookmark. Obviously it's a little more complicated than this. It wasn't easy, but I'm able to do what I need to.

Modificato da eddythorn il