English

If you need to modify the default error page style, you can customize the 404 and other error pages of Webview through the following methods.
Visual interface configuration

Note: It is recommended to use html files and put them in the hybrid/html folder in the project root directory
Source view configuration Open the manifest.json file of the project, switch to the "source view", and configure the error page path according to the project type. It is recommended to use the local address, which is relative to the application root directory; setting the url attribute value to "none" means to disable the custom error page function , the system default error page content is displayed when the page is loaded with errors.
"app-plus": {
"error": {
"url": "hybrid/html/error.html"
},
//...
},
//...
"plus": {
"error": {
"url": "error.html"
},
//...
},
//...
The url address is recommended to use a local address, relative to the application root directory. Set to "none" to turn off the function of jumping to the error page. At this time, the page displays the default error page content of Webview.
When customizing the 404 error page, you may need to get the error cause in the error.html page. You can listen to the "error" event to get the complete error information through the following methods. The example is as follows:
// get error message
document.addEventListener("error", function(e){
var url = e.url; // 错误页面的url地址
},false);
If you need to customize the error page of a Webview window separately, you need to pass the WebviewStyle object when creating The errorPage property controls:
var webview = plus.webview.create("url", "id", styles);
webview.show();
Note: Only 5+App/Wap2App project support