How can I customize error messages.
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)
There are built-in about pages like these (about:neterror):
- https://dxr.mozilla.org/mozilla-release/source/browser/base/content/aboutNetError.xhtml
- view-source:chrome://browser/content/aboutNetError.xhtml
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?
The entities are defined in the files that you can see are linked.
- chrome://global/locale/netError.dtd
- https://dxr.mozilla.org/mozilla-release/source/dom/locales/en-US/chrome/netError.dtd
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+.