【问题标题】:What to do if I get "Cannot Get" error in webpage?如果我在网页中收到“无法获取”错误怎么办?
【发布时间】:2020-11-24 10:25:46
【问题描述】:

我正在 xcode 中创建一个 HTML 文件并尝试在浏览器中显示其内容。我做了一个空文件并写在:

<html>
  <head>
    <title>HTML is Structure Only (After)</title>
  </head>
  <body>
    <h1 style="color: green; font-size: 60px; text-align: center;">HTML is Structure Only</h1>
    <p style="margin: 0 100px 0 100px; font-size: 1.5em;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Recusandae temporibus esse suscipit nisi ad.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad, doloribus eos perspiciatis.</p>
    <footer>
      <hr>
      <p style="text-align: center;"
         onclick="alert('EMAILING US IS USELESS');">
         Tech Support: yeah.right@server-is-down.com
      </p>
    </footer>
  </body>
</html>

cd'd 进入文件所在的目录并运行 browser-sync start --server --files。它没有在 safari 中显示文件内容,而是向我显示了一个 cannot GET / 错误页面。救命???

我使用的是 macOS 10.15。 HTML 文本不是我的,我从讲师的 github 存储库中获取的。

【问题讨论】:

    标签: html xcode npm browser-sync


    【解决方案1】:

    尝试在文档开头、&lt;html&gt; 之前添加&lt;!DOCTYPE html&gt;

    【讨论】:

    • 您有.html 文件吗?示例:test.html
    猜你喜欢
    • 2021-10-24
    • 1970-01-01
    • 2010-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-09
    • 2021-12-18
    相关资源
    最近更新 更多