创建一个自定义的DNS错误页面 [英] Create a custom DNS error page

查看:145
本文介绍了创建一个自定义的DNS错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建新的扩展程序,并且希望在Google Chrome中自定义默认错误页面。我已经通过此处的覆盖页面文档,但尚未找到任何内容关于定制我指定的页面。



任何建议都非常感谢。谢谢。



我想自定义的错误页面是:


网页不可用



无法找到位于 _ ___ 的服务器,因为DNS查找
失败。 DNS是将网站名称翻译为
其互联网地址的网络服务。这个错误通常是由于没有
连接到Internet或错误配置的网络而导致的。它也可能是由于无响应的DNS服务器或防火墙阻止Google
Chrome访问网络导致的
。以下是一些建议:稍后重新加载$ ​​b $ b此网页。检查您的互联网连接。重新启动任何
路由器,调制解调器或您可能正在使用的其他网络设备。检查您的
DNS设置。如果您不确定
这意味着什么,请联系您的网络管理员。尝试按照以下
步骤禁用网络预测:转到扳手菜单>选项>在胡德下,取消选择
预测网络操作以提高页面加载性能。如果此
不能解决问题,我们建议再次选择此选项
以提高性能。将Google Chrome作为允许的程序添加到
防火墙或防病毒软件的设置中。如果它已经是
允许的程序,请尝试从允许的程序
列表中删除它并重新添加。如果您使用代理服务器,请检查您的代理
设置,或联系您的网络管理员以确保代理
服务器正在工作。如果您不相信您应该使用代理
服务器,请调整您的代理设置:转到扳手菜单>选项>
在机盖下>更改代理设置...>局域网设置并取消选择
为您的局域网使用代理服务器复选框。



错误105(net :: ERR_NAME_NOT_RESOLVED):无法解析服务器的
DNS地址。



解决方案

chrome.override 不是为了这个。相反,您可以使用 chrome.webRequest API 检测DNS解析错误。如果你看到这个错误,你可以加载一个不同的URL到标签中。

  chrome.webRequest.onErrorOccurred.addListener(onErrorOccurred,{urls:[ http:// * / *,https:// * / *]}); 

函数onErrorOccurred(details)
{
if(details.error ==net :: ERR_NAME_NOT_RESOLVED)
chrome.tabs.update(details.tabId, {url:...});
}


I am building a new extension and I would like to customize the default error page in Google Chrome. I have gone through the "Override Pages" documentation here but have yet to find anything about customizing the page I have specified.

Any suggestions are much appreciated. Thank you.

The error page I want to customize is:

This webpage is not available

The server at ____ can't be found, because the DNS lookup failed. DNS is the network service that translates a website's name to its Internet address. This error is most often caused by having no connection to the Internet or a misconfigured network. It can also be caused by an unresponsive DNS server or a firewall preventing Google Chrome from accessing the network. Here are some suggestions: Reload this webpage later. Check your Internet connection. Restart any router, modem, or other network devices you may be using. Check your DNS settings. Contact your network administrator if you're not sure what this means. Try disabling network prediction by following these steps: Go to the wrench menu > Options > Under the Hood and deselect "Predict network actions to improve page load performance." If this does not resolve the issue, we recommend selecting this option again for improved performance. Add Google Chrome as a permitted program in your firewall's or antivirus software's settings. If it is already a permitted program, try deleting it from the list of permitted programs and adding it again. If you use a proxy server, check your proxy settings or contact your network administrator to make sure the proxy server is working. If you don't believe you should be using a proxy server, adjust your proxy settings: Go to the wrench menu > Options > Under the Hood > Change proxy settings... > LAN Settings and deselect the "Use a proxy server for your LAN" checkbox.

Error 105 (net::ERR_NAME_NOT_RESOLVED): Unable to resolve the server's DNS address.

解决方案

The chrome.override isn't meant for this. Instead you can detect a DNS resolution error using chrome.webRequest API. If you see this error you can load a different URL into the tab. Something along these lines:

chrome.webRequest.onErrorOccurred.addListener(onErrorOccurred, {urls: ["http://*/*", "https://*/*"]});

function onErrorOccurred(details)
{
  if (details.error == "net::ERR_NAME_NOT_RESOLVED")
    chrome.tabs.update(details.tabId, {url: "..."});
}

这篇关于创建一个自定义的DNS错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆