[userChrome script]Customize firefox error page - 20101201更新

(1,427 views)
October 9, 2010

firefox的错误页面做的不太用户友好,有用的信息不全,这篇文件总结了一些定制和修改错误页面的办法。

目录:
1. 使用脚本增强错误页面
2. css修改错误页面样式

脚本

附件:
0.2 – customizeErrPage_0.2.uc – 20101030
0.1 – customizeErrPage.uc – 20101008
————————————————————-
用了Popup Urlbar以后,一直还觉得挺好,但是有一个问题是:当有很多tab打开时,如果存在一些当前无法访问的页面(它们会在tab中显示firefox定义的对应错误页面,而且显示内容也不是非常用户友好),这时候由于隐藏了地址栏,会不知道这些页面的地址是什么,导致不知道该关闭tab还是要刷新,反正有些不方便。

0.2 – 20101030更新
——————————————————
显示链接修改成可点击,类似于locationbar2的效果

  1. 点击链接的显示框 – 刷新
  2. 鼠标悬停链接段,会有下划线标识,点击则在当前页面跳转
  3. 突出显示domain
  4. 加红显示https

用stylish创建下面这个样式表(或者加到userChrome.css中)

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix(about:neterror) {

#accessURL-protocol, #accessURL-subdomain, #accessURL-port, .accessURL-slash, #accessURL-pathFile{
  color: graytext !important;
}

#accessURL-domain:hover, .accessURL-pathSegment:hover {
   text-decoration: underline !important;
}

#accessURL-protocol[secure] {
  color: red !important;
}

}

下面这个是链接框的DOM结构,用css可以按照自己的想法美化


———————————————————–
0.1 – 初始版本
下面这个脚本就是解决这个问题的,会在错误页面里加入一个显示框,以大号字体显示访问地址。

附件下载:customizeErrPage.uc

—————————————————————–

用CSS定制错误页面样式

1. 修改错误页面里的显示图标
用下面这个css可以按照不同的错误原因显示不同的图标,这样更直观一些。

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix(about:neterror?e=generic) {
  #errorPageContainer {
    background-image: url(image_url_here) !important;
  }
}

about:neterror?e=generic这部分能够区分不同的错误原因:
e后面填上具体错误原因的名字,image_url_here替换成你想显示的图片地址。
firefox定义了下面这些错误名字:

  • dnsNotFound
  • fileNotFound
  • malformedURI
  • protocolNotFound
  • connectionFailure
  • netTimeout
  • redirectLoop
  • unknownSocketType
  • netReset
  • netOffline
  • netInterrupt
  • deniedPortAccess
  • proxyResolveFailure
  • proxyConnectFailure

related post

(1,427 views)

One Response to [userChrome script]Customize firefox error page

  1. Pingback: Xiao Shan » [userChrome script]centerUrlAndSearchBar – 居中地址栏和搜索框 (扩展版 – Popup Url and Search Bar)

①若要贴代码,请将 "<" 改成 "&lt;",">" 改成 "&gt;".
②若要从他人留言中复制代码,注意检查引号可能是中文的,请手动修改成英文符号,避免不能工作