Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Научете повече

Using an autoconfig file to create bookmarks

  • 3 отговора
  • 1 има този проблем
  • 1 изглед
  • Последен отговор от 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");

Променено на от eddythorn

Избрано решение

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.

Прочетете този отговор в контекста 👍 0

Всички отговори (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

Избрано решение

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.

Променено на от eddythorn