为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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