搜尋 Mozilla 技術支援網站

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

了解更多

How can I customize error messages.

  • 3 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 cor-el

more options

I have my own scripts and I would like to customize some error pages so it can take some customized actions. - Is this possible? - Where to start from? - Where to grap the error HTML page and where to place my script? - If not, what are the alternatives? can I perfrom this via an extension? But the problem is that I want to display my error page before the original error page appears. I could not find a way to do such thing as "page-mod" changes URLs and I could not find the error pages URL that get displayed. When error occurs, the same URL stays as it is in the URL bar without error page link.

I have my own scripts and I would like to customize some error pages so it can take some customized actions. - Is this possible? - Where to start from? - Where to grap the error HTML page and where to place my script? - If not, what are the alternatives? can I perfrom this via an extension? But the problem is that I want to display my error page before the original error page appears. I could not find a way to do such thing as "page-mod" changes URLs and I could not find the error pages URL that get displayed. When error occurs, the same URL stays as it is in the URL bar without error page link.

所有回覆 (3)

more options

There are built-in about pages like these (about:neterror):

more options

I viewed the code. Neat but quite complex to be honest. Can you give a simple example please on how to specify the parameters for one error message, e.g. how to change the script. Where are these parameters read from? For example: "<title>&loadError.label;</title>", where is "loadError.label" is read from? how can I customize it?

more options

The entities are defined in the files that you can see are linked.

Customizing these pages is beyond the scope of this forum and best would be to ask advice at the Add-ons forum since you would need an extension. I do not know if this is possible with a WebExtension because otherwise your XUL based extension will stop working in Firefox 57+.