火狐错误信息的 HTML 来源(无法建立此连接错误显示)



我一直试图在我的一个网站中复制无法建立连接的错误。我试图从firefox浏览器中的错误消息中复制HTML。我试图找到默认错误页面(加载页面出现问题)的来源。当我选择文本并在右键菜单中选择选择源时,我找到了以下源。

<h1 id="errorTitleText">Unable to connect</h1>
      </div>
      <!-- LONG CONTENT (the section most likely to require scrolling) -->
      <div id="errorLongContent">
        <!-- Short Description -->
        <div id="errorShortDesc">
          <p id="errorShortDescText">Firefox can't establish

如何找到完整的源代码?

安装firebug,然后在出现错误页面时按HTML选项卡。

    <!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->

    <!-- PAGE CONTAINER (for styling purposes only) -->
    <div xmlns="http://www.w3.org/1999/xhtml" id="errorPageContainer">
      <!-- Error Title -->
      <div id="errorTitle">
        <h1 id="errorTitleText">Server not found</h1>
      </div>
      <!-- LONG CONTENT (the section most likely to require scrolling) -->
      <div id="errorLongContent">
        <!-- Short Description -->
        <div id="errorShortDesc">
          <p id="errorShortDescText">Firefox can't find the server at www.bbc.co;uk.</p>
        </div>
        <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
        <div id="errorLongDesc">
<ul>
  <li>Check the address for typing errors such as
    <strong>ww</strong>.example.com instead of
    <strong>www</strong>.example.com</li>
  <li>If you are unable to load any pages, check your computer's network
    connection.</li>
  <li>If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.</li>
</ul>
</div>
        <!-- Override section - For ssl errors only.  Removed on init for other
             error types.  -->
      </div>
      <!-- Retry Button -->
      <button id="errorTryAgain" autocomplete="off" onclick="retryThis(this);">Try Again</button>
    </div>
    <!--
    - Note: It is important to run the script this way, instead of using
    - an onload handler. This is because error pages are loaded as
    - LOAD_BACKGROUND, which means that onload handlers will not be executed.
    -->
    <script xmlns="http://www.w3.org/1999/xhtml" type="application/javascript">initPage();</script>

对于CSS,它似乎使用:chrome://global/skin/netError.css

/*
 *  This defines the look-and-feel styling of the error pages.
 *  (see: netError.xhtml)
 *
 *  Original styling by William Price <bugzilla@mob.rice.edu>
 *  Updated by: Steven Garrity <steven@silverorange.com>
 *              Henrik Skupin  <mozilla@hskupin.info>
 */
html {
  background: -moz-Dialog;
}
body {
  margin: 0;
  padding: 0 1em;
  color: -moz-FieldText;
  font: message-box;
}
h1 {
  margin: 0 0 .6em 0;
  border-bottom: 1px solid ThreeDLightShadow;
  font-size: 160%;
}
ul, ol {
  margin: 0;
  -moz-margin-start: 1.5em;
  padding: 0;
}
ul > li, ol > li {
  margin-bottom: .5em;
}
ul {
  list-style: square;
}
#errorPageContainer {
  position: relative;
  min-width: 13em;
  max-width: 52em;
  margin: 4em auto;
  border: 1px solid ThreeDShadow;
  border-radius: 10px;
  padding: 3em;
  -moz-padding-start: 30px;
  background: url("chrome://global/skin/icons/warning-large.png") left 0 no-repeat -moz-Field;
  background-origin: content-box;
}
#errorPageContainer.certerror {
  background-image: url("chrome://global/skin/icons/sslWarning.png");
}
body[dir="rtl"] #errorPageContainer {
  background-position: right 0;
}
#errorTitle {
  -moz-margin-start: 80px;
}
#errorLongContent {
  -moz-margin-start: 80px;
}
#errorShortDesc > p {
  overflow: auto;
  border-bottom: 1px solid ThreeDLightShadow;
  padding-bottom: 1em;
  font-size: 130%;
  white-space: pre-wrap;
}
#errorLongDesc {
  -moz-padding-end: 3em;
  font-size: 110%;
}
#errorLongDesc > p {
}
#errorTryAgain {
  margin-top: 2em;
  -moz-margin-start: 80px;
}
#brand {
  position: absolute;
  right: 0;
  bottom: -1.5em;
  -moz-margin-end: 10px;
  opacity: .4;
}
body[dir="rtl"] #brand {
  right: auto;
  left: 0;
}
#brand > p {
  margin: 0;
}
#errorContainer {
  display: none;
}
#securityOverrideDiv {
  padding-top: 10px;
}
#securityOverrideContent {
  background-color: #FFF090; /* Pale yellow */
  padding: 10px;
  border-radius: 10px;
}
/* Custom styling for 'blacklist' error class */
:root.blacklist #errorTitle, :root.blacklist #errorLongContent,
:root.blacklist #errorShortDesc, :root.blacklist #errorLongDesc,
:root.blacklist a {
  background-color: #722; /* Dark red */
  color: white;
}
:root.blacklist #errorPageContainer {
  background-image: url("chrome://global/skin/icons/blacklist_64.png");
  background-color: #722;
}
:root.blacklist {
  background: #333;
}
:root.blacklist #errorTryAgain {
  display: none;
}

如果您无法连接到服务器,您将无法获得任何源代码。

如果您可以访问源代码,则根据定义,您必须已连接。

最新更新