export bookmarks.html files
In Firefox 5 on exporting HTML files, two unnecessary elements are included for each web page entry; namely, < DT >< A HREF="http://www ... ICON_URI=" ... /favicon.ico" ICON="data:image/png;base64 , ... < /A >
These two elements (ICON_URI and ICON) add significantly to the storage size of the bookmarks.html file which keeps getting larger and larger.
These two elements are not necessary in my opinion. Please remove those two elements: the ICON_URI=" ... /favicon.ico" and the ICON="data:image/png;base64 , from the bookmarks.html file structure; or at least give an option for their inclusion or not in the exported HTML file.
moderator fixed the code so it will display
השתנתה ב־
פתרון נבחר
You can remove those attributes with this bookmarklet if you open the HTML file in Firefox via File > Open File.
javascript:(function(){ var ls=document.getElementsByTagName('A'),l,i; for (var i=0; l=ls[i]; i++) {l.removeAttribute('ICON'); l.removeAttribute('ICON_URI');} alert('Cleanup Complete - Save as Web Page, Complete')})();Read this answer in context 👍 1
כל התגובות (17)
Can you give an example with 1 codeline and tell me again what's wrong ? Maybe I can fix it for you :)
First part of my bookmark.htm file with the first web page entry; notice the element ICON_URI= ... and the element ICON="data:image/png;base64, with the long code following.
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <TITLE>Bookmarks</TITLE>
Bookmarks Menu
Favorite
- <p>
<DT><A HREF="http://www.biblegateway.com/" ADD_DATE="1309734502" LAST_MODIFIED="1309734502" ICON_URI="http://static5.bgcdn.com/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACY0lEQVQ4jX1TS0iVQRQeMFz1hKAHrUoSuXnv/3+nhxERFIYZEVRWSEsXQRC9S3Ex/5wDEULuwlYRtBIqcBWRtCjCSAgfM+dsI1wEbioLWsht4dWuvQ4Mwzy+b8755jvO1UVkHJxi2ra4Tp6ggbqN81PRo8n9LxLjgjLuvvRuRfRZpoxxE6rWDxXctxvNq/4AK+OECt4Nd7mG5NGmQrMaMKAh3xtDpTQdsn3K9LBG9Db60sol8JhvWq2MmcRZZ/SlRhV6njjrNMn7TTChjBljjJrPd8YiO25CVQ0Y+PW65FeM8WmhjKzTAl1UwQNl6p0OeSWGSskEgyZUjYyOxBAVzC2VooJ3JnhRE7HDGNeT4IwK+lQwooxHqY82xYBzxvRxOmS7TOh78oQaAX1RxmPnnJtitKSQn9WQF7HIj0z48pYFIJL5fLMxvdIiP6mCmDzaFgX8oYw3zjk33OUaUkFHjcvNy34oUE/i/KYF3EmBeozp9XufrY0B+50yZpTp21Tfjg3OOTd5q3Vd9KXGeoIpRosK+kzyfmW6aoJB55zTgAGngmcmVE2My//yiIb8gDGup0A9Guj2uKf1xuVmY3rqLOTnF0xCs5O+devv4PGbtCYyOmKRH9ICx6IvbXTOOWOMJsGNmg/oQ80kqr6yvZ5guMs11M813YZUaHbMN62ubdBhY8ybUNWYPitT76ImixF9qTEVWbsJvTWhaiqy9mWpxoDTKphb8j3jqzKNqWDEGKPKmFk6C9T9V7GMy80qeKKMH783kjHmVTCSfHnHv8Suy4b2qNA1ZQwZ070UcCn6yu6/3f0J/+tsEI9Pu3EAAAAASUVORK5CYII=">Bible</A>
פתרון נבחר
You can remove those attributes with this bookmarklet if you open the HTML file in Firefox via File > Open File.
javascript:(function(){ var ls=document.getElementsByTagName('A'),l,i; for (var i=0; l=ls[i]; i++) {l.removeAttribute('ICON'); l.removeAttribute('ICON_URI');} alert('Cleanup Complete - Save as Web Page, Complete')})();
That favicon.ico data:image/png;base64, was for the storage of Favicons in the old Firefox 0.9 thru 2.0.0.20 versions. It doesn't serve any useful purpose these days, but I guess the developers don't want to waste their time removing the code for generating that data, since that file really is only being used for exporting in bookmarks.html format.
And, yes it wastes a lot of space - with only about 1/3 of my bookmarks even having a Favicon, a bookmarks.html file that was like 2MB ended up being a little more than 400KB once the Favicon data was removed.
See this MozillaZine thread for a bookmarklet you can use to clear the Favicon data and other useless stuff from a bookmarks.html file.
http://forums.mozillazine.org/viewtopic.php?p=3306643#p3306643
Thanks for the javascript bookmarklet.
Sorry ... but what do I do with it? Where do I place it in order to clear the ICON and ICON_URI attributes?
See this - http://www.bookmarklets.com/ - for an explanation about what a bookmarklet is about and how it works.
Create a new bookmark and paste that javascript code into the Location: line of the bookmark.
Load the bookmarks.html file in the browser ( File > Open File... ) and then click on the bookmarklet. You can watch the CPU meter in the Task Manager to see when the bookmarklet has finished "doing its thing".
You might want to read all the postings in this thread - http://forums.mozillazine.org/viewtopic.php?f=7&t=538462 - which is an old thread, but is from the last days of the bookmarks.html file being used a the form of storage of bookmarks in Firefox. Relatively few users do anything with bookmarks.html files any longer. I still use that format, primarily to have my bookmarks available on my personal web space, so I can access them from any PC I may be using away from my home office.
Thank you for the links about bookmarklets and related forums.
The reason that I export bookmarks.html files is to place them on my web space in order to access the organized and classified URLs from anywhere. Have a look at http://www3.telus.net/eekman/bookmark.htm
In the old days of Netscape it was easy to produce these bookmark HTML files. But Netscape is no longer compatible with my operating system so I have been looking for a replacement procedure. The Internet Explorer 8 and 9 exported bookmark files I find clumsy and irritating because they do not retain the organization I wish rather they reorganize the bookmark file into a default alphabetic sort. However, Firefox 5 has been convenient because it retains the order that I have created. I edit the exported Firefox bookmarks.html file using Notepad++ and save the edited file as bookmark.htm because the word "bookmark" has 8 characters in the file name. This avoids any long-name problems when using Filezilla to upload to my web space.
Thanks again ... the bookmarklet works very well and removes all the unnecessary attributes especially those with ICON.
I copied the javascript bookmarklet from its code source then pasted it on the Firefox Bookmarks Toolbar.
Prior to the copy/paste procedure I edited the bookmarklet slightly so that it would remove all attributes from bookmarks.html files; one bookmarlet to do the job of removing all of them. Please see:
javascript: (function(){ var ls=document.getElementsByTagName('*'), lsl=ls.length; for (var i=0; i<lsl; i++) {l=ls[i]; l.removeAttribute('id'); l.removeAttribute('last_charset'); l.removeAttribute('icon'); l.removeAttribute('ICON_URI');l.removeAttribute('last_modified'); l.removeAttribute('last_visit'); l.removeAttribute('add_date'); l.removeAttribute('personal_toolbar_folder');} var e=document.getElementsByTagName('dd'); el=e.length; for(var i=el-1;i>=0;i--) e[i].parentNode.removeChild(e[i]); alert('Cleanup Complete - Save as Web Page, Complete\n'+'('+lsl+' bookmarks, '+el+' descriptions)')})();
edited with pre & nowiki start and end tags for the bookmarklet script
השתנתה ב־
I added a couple tags by editing your posting, to overcome a shortcoming with the software used here, to override it trying to "execute" certain bits of code.
I "peeked" at cor-el's posting to see the code he posted to remind myself of the pre & nowiki code we need to un-munge code that is posted here.
Thank you!
I added that as a new bookmarklet to my collection, that numbers over 200 bookmarklets.
Here's an old bookmarks.html file that I uploaded years ago; Favicons were removed, but it isn't the latest version of the bookmarklet that dickvl eventually came up with. There's still some un-needed tags in there. I also added some css and a background image to dress it up a bit.
http://the-edmeister.home.comcast.net/~the-edmeister/html/bookmarks-Firefox_and_Mozilla_Info.html
השתנתה ב־
Seems one can modify the appearance of bookmark files by adding style sheet features. Please see my bookmark.htm after such a modification: http://www3.telus.net/eekman/bookmark.htm
If you open it using Notepad++ or Notepad, you will see the style sheet entry, and see that all attributes have been removed from the body.
Yep, I noticed how clean the code was when you first posted the URL of that page. That textured #c0c0c0 background spiffs it up a bit. Almost any HTML attribute can be used.
I just exported my current bookmarks, stripped the excess tags & data, added the css, and uploaded the file. 129MB down to 132KB = ~ 1/10 the original size.
http://the-edmeister.home.comcast.net/~the-edmeister/html/MZ_07-09-2011_the-edmeister_Bookmarks.htm
השתנתה ב־
Please click the Solved It button next to the answer that answered or solved your Firefox support issue, it appears when you are logged in, so this thread gets marked as Solved to help other users who may have this same problem.
http://the-edmeister.home.comcast.net/~the-edmeister/html/MZ_07-09-2011_the-edmeister_Bookmarks.htm
That file has a problem with the DD tags: all bookmarks are in the first DD tag, so you need to stop at i=1 (i>0) to avoid removing them all.
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(L)})();
There is a new version that removes a few more attributes.
javascript:(function(){var a='ID,ICON,ICON_URI,LAST_CHARSET,LAST_MODIFIED,LAST_VISIT,ADD_DATE,PERSONAL_TOOLBAR_FOLDER,SHORTCUTURL,WEB_PANEL',A,d=document,e=d.getElementsByTagName('*'),E,i,j,k=0,L=0;if(a=prompt(a.split(',').join('\n'),a)){a=a.split(',');for(i=0;E=e[i];i++){for(j=0;A=a[j];j++){E.removeAttribute(A)};if(E.nodeName=='A'){k++}}}e=d.getElementsByTagName('DD');if((L=e.length)&&(confirm('Remove '+L+' description(s)?'))){for(i=L-1;i>=0;i--){e[i].parentNode.removeChild(e[i])}}else{L=0}alert('Cleanup Complete - Save as Web Page, Complete\n\n'+k+' bookmarks\n'+L+' descriptions')})();
If there are problems with removing the descriptions then try for(i=L-1;i>0;i--) instead of for(i=L-1;i>=0;i--)
השתנתה ב־
Right now I'm not even sure which bookmarklet I used when stripping the excess code. I have too many saved in the same folder and I didn't name them too well. Plus being up for 19 hours doesn't help my level of concentration.
I'll give that new version a shot later today when I get home from work.
1. It would be good to have a single bookmarklet that removes all unnecessary attributes.
2. Seems when the DD code is included in the bookmark HTML file code structure the action of the bookmarklet results in the bookmarked URLs being removed in addition to the unnecessary attributes.
In my saved bookmark HTML files normally the DD code is not included; the DD does not appear in the HTML code structure.
3. In Internet Explorer, all versions, my bookmark.htm file displays with hierarchical indentation ... as I wish. However, with Firefox the bookmarked URLs are listed in a single column with no subsection indentation. Do you know a way to make the Firefox display the bookmark.htm (or bookmarks.html) file with hierarchical indentation?
This is my bookmark file that is displayed differently in Internet Explorer and Firefox. http://www3.telus.net/eekman/bookmark.htm
Firefox 4 and later treat the DT element differently and that causes a quirk style rule (dl > dl) not to get applied.
Add this style to the stylesheet:
dl > dt > dl {display: block;-moz-margin-start: 40px;}
That solved the Firefox hierarchical indentation issue! Where did you find/develop that inclusion to the style sheet? I do not understand the code but added it to the style sheet nevertheless: dl > dt > dl {display: block;-moz-margin-start: 40px;}
Now my "bookmark.htm" file, http://www3.telus.net/eekman/bookmark.htm, displays properly both in Internet Explorer and Firefox.
Also, I added at the bottom of the bookmark file an hr tag just for fun. It makes for a nice conclusion/finale to the URL list, I think.
Do you have any more suggestions to improve the bookmark.htm file structure?
Is it important to you which of the extensions .html or .htm to use? Personally, in general, I like three character extensions ... not four or two ... and 8 or less characters for the file name.
In web page development (I do "raw" HTML coding only, do not use editors like Dreamweaver, and use Notepad++ or Notepad for text editing the HTML code), I'm mostly interested in how web pages display in Internet Explorer and in Firefox? Other browsers are not as important to me and are not on my radar.