為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

exported bookmarks file size

  • 14 回覆
  • 1 有這個問題
  • 2 次檢視
  • 最近回覆由 user700204

more options

So every once in a while for safekeeping, I like to export my Firefox bookmarks using "Export Bookmarks to html". I've got a couple of hundred bookmarks. I just noticed that the html exported file size was 8MB! What in the world makes that file so big!? I figured it was just some kind of text file with "name" and "location", which ought to be a lot smaller. I look at the file in Firefox and it shows, as expected, just a few pages of names with linked URLs. But I look at the file as a text file, and there are 1800 pages including what look like enormous png files! What is all that crap? Why does my bookmark file have enormous png files in it?

So every once in a while for safekeeping, I like to export my Firefox bookmarks using "Export Bookmarks to html". I've got a couple of hundred bookmarks. I just noticed that the html exported file size was 8MB! What in the world makes that file so big!? I figured it was just some kind of text file with "name" and "location", which ought to be a lot smaller. I look at the file in Firefox and it shows, as expected, just a few pages of names with linked URLs. But I look at the file as a text file, and there are 1800 pages including what look like enormous png files! What is all that crap? Why does my bookmark file have enormous png files in it?

由 user700204 於 修改

所有回覆 (14)

more options

You may have old or corrupt entries.

See if this helps.

[v57+] Places Maintenance is built into Firefox.

Type about:support<enter> in the address bar.

You will find Places Database near the bottom. Press the Verify Integrity button.

When done, copy and post the results here.

more options

> Task: checkIntegrity + The places.sqlite database is sane + The favicons.sqlite database is sane > Task: invalidateCaches + The caches have been invalidated > Task: checkCoherence + The database is coherent > Task: expire + Database cleaned up > Task: originFrecencyStats + Recalculated origin frecency stats > Task: vacuum + Initial database size is 10240KiB + The database has been vacuumed + Final database size is 10240KiB > Task: stats + Places.sqlite size is 10240KiB + Favicons.sqlite size is 13440KiB + pragma_user_version is 52 + pragma_page_size is 32768 + pragma_cache_size is -2048 + pragma_journal_mode is wal + pragma_synchronous is 1 + History can store a maximum of 108774 unique pages + Table moz_places has 12652 records + Table moz_historyvisits has 16157 records + Table moz_inputhistory has 16 records + Table moz_hosts has 0 records + Table moz_bookmarks has 3217 records + Table moz_bookmarks_deleted has 0 records + Table moz_keywords has 0 records + Table sqlite_sequence has 0 records + Table moz_anno_attributes has 4 records + Table moz_annos has 828 records + Table moz_items_annos has 126 records + Table moz_meta has 8 records + Table sqlite_stat1 has 18 records + Table moz_origins has 2205 records + Index sqlite_autoindex_moz_inputhistory_1 + Index sqlite_autoindex_moz_hosts_1 + Index sqlite_autoindex_moz_bookmarks_deleted_1 + Index sqlite_autoindex_moz_keywords_1 + Index sqlite_autoindex_moz_anno_attributes_1 + Index sqlite_autoindex_moz_origins_1 + Index moz_places_url_hashindex + Index moz_places_hostindex + Index moz_places_visitcount + Index moz_places_frecencyindex + Index moz_places_lastvisitdateindex + Index moz_places_guid_uniqueindex + Index moz_historyvisits_placedateindex + Index moz_historyvisits_fromindex + Index moz_historyvisits_dateindex + Index moz_bookmarks_itemindex + Index moz_bookmarks_parentindex + Index moz_bookmarks_itemlastmodifiedindex + Index moz_bookmarks_dateaddedindex + Index moz_bookmarks_guid_uniqueindex + Index moz_keywords_placepostdata_uniqueindex + Index moz_annos_placeattributeindex + Index moz_items_annos_itemattributeindex + Index moz_places_originidindex > Task: _refreshUI

more options

An HTML backup includes the favicons and this base64 icon data can take up a lot of space. There is also still description data saved.

It is possible to open this file in a Firefox tab and use a bookmarklet to remove this icon data. You can create a new bookmark and paste the JavaScript code in its Location field.


ICON:

javascript:(function(){var A='ICON',e=document.getElementsByTagName('a'),E,i,j=0;for(i=0;E=e[i];i++){if(E.hasAttribute(A)){E.removeAttribute(A);j++}}alert('Ready, removed "'+A+'": '+j)})();

DESCRIPTION:

javascript:(function(){var E=document.getElementsByTagName('dd'),L=E.length,i;for(i=L-1;i>=0;i--){E[i].parentNode.removeChild(E[i])}alert('Ready\n\n\Found: '+L);})()
more options

Well, favicons would explain png files, but favicons are TINY. I mean, if a standard favicon size for Firefox is 1KB, and I have a few hundred bookmarks, that would be a lot less than 1MB.

Now, 8MB is no big deal in the larger picture, but it's telling me there is a lot in that file that I sure don't need. To me, a bookmark is a name and a URL. Period.

If there were a simple way to remove that debris from several hundred bookmarks, I'd be interested.

more options

Did you ever create such a backup before?

Did you check the content of this bookmarks HTML backup in a text editor?

Like I wrote above, you can open the file in a Firefox tab and use a bookmarklet to remove some specific data like the favicons. A bookmarklet is some JavaScript that can be used to perform some action, in this case remove an attribute. The way to use a bookmarklet is to create a bookmark and paste the script code in its location field. If you create this bookmark on the Bookmarks Toolbar then you only have to click this bookmark to run this code.

  1. create a new bookmark on the Bookmarks toolbar via the right-click context menu
  2. give the bookmark a name
  3. copy and paste the full JavaScript code in the location field of the new bookmark
  4. give the new bookmarks a keyword like "icon" (without quotes)
more options

Yes, I create such a backup every few months, but I only now just noticed that it had a size that was really hard to justify.

Your methodology for revising bookmarks is interesting, but it isn't clear that I can do it on several hundred bookmarks all at once. Are you saying your Javascript code removes favicons from ALL of my bookmarks? I'm certainly not going to take many hours individually doctoring a few hundred bookmarks. Actually, not clear that I'm going to do it even for one bookmark.

See, my question isn't based on a problem. It really doesn't hurt me that the backup takes 8 MB. I'm just astonished that it does, and am trying to figure out why.

由 user700204 於 修改

more options

Yes, this JavaScript code processes the HTML file and removes all ICON attributes from A Tags. If you save the resulting file then its file size should be smaller.

The ICON_URI attribute stores a link to the icon file on internet as you can see if you inspect the file (in Firefox: View Page Source), so is still available if you would import this backup.

This version allows to specify what attributes you want to remove like some dates to reduce the file size further.

javascript:(function(){var a='ICON,LAST_CHARSET,LAST_MODIFIED,LAST_VISIT,ADD_DATE',A,d=document,e=d.getElementsByTagName('*'),E,i,j,k=0,L=0;a=a.split(',');for(i=0;E=e[i];i++){for(j=0;A=a[j];j++){E.removeAttribute(A)};if(E.nodeName.toUpperCase()=='A'){k++}}alert('Cleanup Complete - Save as Web Page, Complete\n\n'+k+' bookmarks\n')})();
more options

Oh, that's slick. Now, how do I use that javascript command, and how do I point it at my exported bookmark file?

more options

The Javascript gets run thru the Location Bar / URL Bar just like entering a website address.

Typically that Javascript code gets saved in the "Location" field of a Bookmark in Firefox; save it once and use it from then on whenever you need to use it. Simply create a new Bookmark, name it, and copy'paste that Javascript into the Location field. With the bookmarks.html file loaded in Firefox click on the ICON_URI Bookmarklet and all the ICON attributes for the A lines will be stripped. Then save the resulting "stripped file".

Here are a couple of websites that explain a bit more about Bookmarklets and offer useful Bookmarklets https://edmullen.net/mozilla/moz_bmarks.php

Example page is here where you can drag'n'drop the Bookmarklet into your Firefox bookmarks: https://edmullen.net/mozilla/bookmarklets.php Drag the hyperlink into your bookmarks (onto the Bookmarks Toolbar or into the Bookmarks Sidebar)

Another source is here - from a Firefox developer on the mid-00's. https://www.squarefree.com/bookmarklets/

I have a couple of hundred Bookmarklets which I have saved over the last 20 years. Very handy when working with HTML files for editing the contents of HTML files.

more options

OK, just to get some closure here. I have now learned the right way to do bookmark backups. You do "Backup" (which leads to a json file of bookmarks), instead of "Export to HTML". The former json file is a reasonably compact file, while the latter html file is bloated with Favicons. My html file is 8MB, and my json file is 1MB.

See here

[[Knowledge Base Article|https://support.mozilla.org/en-US/questions/1245377?utm_campaign=questions-reply&utm_medium=email&utm_source=notification]]

So instead of taking that html file and removing the Favicon bloat from it, a more sensible approach is just not to write the bloat to begin with. This has been a useful discussion. Thanks to everyone who contributed.

由 user700204 於 修改

more options

The bookmark files in the profile are compressed. I've noticed some exported files are just json or html & they're quite a bit larger.

Just use a compression archiver & you can compress the whole folder where they're exported. Use a compression tool that has a verify the compressed copies for errors, like 7-Zip, then use verification after creating an archive.

more options

We're talking about the "Export" or "Backup" files. Those aren't compressed. Yes, the ones in the Profile/Bookmark backups are compressed. Curiously, it seems not to be zip compression. Unzip won't uncompress them.

But yes, that's a good point that those Backup json files are already available in Profiles, and that at least when zip-compressed, the json bookmark backup files are much smaller.

由 user700204 於 修改

more options

As a footnote, Firefox files whose extensions end with lz4 (.jsonlz4, .mozlz4) are compressed using LZ4 with a Mozilla twist.

more options

Ah, thank you. Never knew that. Why LZ4? For archiving purposes, just Export-ing a json bookmarks file and zipping it is the easiest solution.

由 user700204 於 修改