Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

搜尋 Mozilla 技術支援網站

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

了解更多

bookmarks.html Renders Very Differently in FireFox 4

  • 7 回覆
  • 23 有這個問題
  • 8 次檢視
  • 最近回覆由 stormseye

more options

For years, I have been using and loving Firefox (including 4.0).

For years, I have also exported my bookmarks out of Firefox and use the resulting bookmarks.html file as my home page.

Now Firefox 4 renders the bookmarks.html file very differently from previous versions of Firefox and also differently from other browsers (eg, IE).

The indentations have disappeared when viewing bookmarks.html in Firefox 4. Unfortunately, it's not really easy to show you this inside this forum text box, but I will try.

Firefox 4 shows something like this:


Bookmarks Menu


General Interest

Markham Weather Forecast - Environment Canada
The Weather Network - Markham
The Weather Channel - Markham
AccuWeather.com - Canadian Forecast Center 

... etc


Firefox 3.6, IE, and other browsers show something like this (note the indentations which greatly improve readability):


Bookmarks Menu


     General Interest
           Markham Weather Forecast - Environment Canada 
           The Weather Network - Markham 
           The Weather Channel - Markham 
           AccuWeather.com - Canadian Forecast Center 
           ... etc

Is this a bug in Firefox 4?? I would really like to see bookmarks.html rendered with the indentations.

Am I missing something? Thanks.

For years, I have been using and loving Firefox (including 4.0). For years, I have also exported my bookmarks out of Firefox and use the resulting bookmarks.html file as my home page. Now Firefox 4 renders the bookmarks.html file very differently from previous versions of Firefox and also differently from other browsers (eg, IE). The indentations have disappeared when viewing bookmarks.html in Firefox 4. Unfortunately, it's not really easy to show you this inside this forum text box, but I will try. Firefox 4 shows something like this: ------------------------------------------------------------- '''Bookmarks Menu''' ---------------------------------------------------------------------- '''General Interest''' Markham Weather Forecast - Environment Canada The Weather Network - Markham The Weather Channel - Markham AccuWeather.com - Canadian Forecast Center ... etc ------------------------------------------------------------- Firefox 3.6, IE, and other browsers show something like this (note the indentations which greatly improve readability): ------------------------------------------------------------- '''Bookmarks Menu''' ---------------------------------------------------------------------- '''General Interest''' Markham Weather Forecast - Environment Canada The Weather Network - Markham The Weather Channel - Markham AccuWeather.com - Canadian Forecast Center ... etc ------------------------------------------------------------- Is this a bug in Firefox 4?? I would really like to see bookmarks.html rendered with the indentations. Am I missing something? Thanks.

由 stormseye 於 修改

被選擇的解決方法

You can add this CSS code to the HTML file below the line with the meta tag or use the copy method posted above by stormseye

<style type="text/css" >
dl > dt > dl {
 margin-left: 40px;
}
</style>
從原來的回覆中察看解決方案 👍 3

所有回覆 (7)

more options

I can verify that a bookmarks.html file shows folder levels "tabbed" over to the right in Firefox 3.6.x and doesn't do the same in Firefox 4.0.

!DOCTYPE NETSCAPE-Bookmark-file-1> is not a valid HTML file and was never meant to be displayed as a webpage, it is displayed in the Quirks Mode by web browsers. This file format was used by Netscape, Mozilla, and few other browser maker's as a storage file for bookmarks and is the interchange format for importing and exporting bookmarks / favorites between most all brands of browsers for the last 15 or 16 years.

The "tags" used in the Netscape bookmarks.html file for "folder" structure - DT, DD, & DL aren't valid HTML code used on webpages and I guess Gecko 2.0 doesn't "guess" the same as Gecko 1.9.2 and earlier did. There's a whole bunch of other data in the Netscape bookmarks.html file that Firefox has always ignored when displayed as a web page because it wasn't "valid code". Firefox 4.0 seems to be ignoring the folder structure tags now.

http://en.wikipedia.org/wiki/Quirks_Mode

Sorry, I can't think of a way to overcome this change, short of writing a script to change all those "tags" to proper HTML tags and running that script after you export the bookmarks.html file from Firefox. Cor-el might have some script ideas, if he sees this thread.

more options

I see in the DOM Inspector that Firefox 4 places the content if the DT container. Firefox 3 acts differently and can use DL > DL to get the indent.

This bookmarklet seems to work to get the indent again:

javascript:(function(){var d=document,sS=('dl > dt > dl { margin-left: 40px; }'),nS=d.createElement('STYLE');nS.setAttribute('type','text/css');nS.innerHTML=unescape(sS);d.getElementsByTagName('head')[0].appendChild(nS);})();

more options

Cor-el - is there a way that can be added to the bookmarks.html file, instead of having to click on a bookmarklet each time the page is opened?

more options

edmeister, cor-el: Thanks for your input.

cor-el's bookmarklet script works, though, as edmeister points out, it is a bit inconvenient.

I am thinking that a wrapper for the bookmarks.html file might work. The wrapper (say, wrapper.html or wrapper.js) could load the bookmarks.html file and then run the equivalent of cor-el's bookmarklet. The wrapper file would then become my "home page".

Unfortunately, I am not an expert with HTML of JS, although I have done some very simple stuff with them. (Over the years, I have done a lot of programming in other languages.)

Any advice on how to create such a wrapper would be much appreciated. An example would be even better.

My own attempts to do this have not been successful. I suspect that the wrapper execution stops as soon as bookmarks.html is told to start. That would actually make sense. Otherwise, generally, this approach could open some serious security concerns.

Thanks.

由 stormseye 於 修改

more options

Okay, I found a simple way to make this happen.

1) I created a file called bookmarksAddendum.html and filled it with a re-formatted version of cor-el's bookmarklet script:

<script type="text/javascript">

 var d=document;
 var sS=('dl > dt > dl { margin-left: 40px; }');
 var nS=d.createElement('STYLE');
 nS.setAttribute('type','text/css');
 nS.innerHTML=unescape(sS);
 d.getElementsByTagName('head')[0].appendChild(nS);

</script>


2) I created a Windows command script called bookmarksAddendum.cmd and filled it with the following to append the bookmarksAddendum.html file to the bookmarks.html file:

COPY bookmarks.html + bookmarksAddendum.html bookmarks.html

EXIT

3) After running the bookmarksAddendum.cmd file, the bookmarks.html file is rendered with subfolder indentations in Firefox 4.

This works even if the .cmd file is run more than once.

It would be nice if there were a simpler way to get the same result. Ideally, the Gecko engine would handle this natively.

more options

選擇的解決方法

You can add this CSS code to the HTML file below the line with the meta tag or use the copy method posted above by stormseye

<style type="text/css" >
dl > dt > dl {
 margin-left: 40px;
}
</style>
more options

Thanks cor-el. That is a simpler, more concise solution and I am now using it in my bookmarksAddendum.html file.

I have also changed my bookmarksAddendum.cmd file to use the following instead of the COPY command:

TYPE bookmarksAddendum.html >> bookmarks.html