roy-tian / learning-area

MDN 学习区示例中文版

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meta-example.html has problem

modoojunko opened this issue · comments

I follow the steps
image
and add <script> and <style>
I can not get same result like that.

So I checked. the console gives this error
image

I found some pages that said <script> should be after the body.

I tried it works.

In the meta-example.html there has "defer". It means after HTML body loaded , load this.
<script src="script.js" defer></script>

My point is this, learn page does not include what is defer means.

could you add this defer information on MDN learn page? (https://developer.mozilla.org/zh-CN/docs/learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML)

the javascipt is not find the body' label when it happened .
you can try to use the way after.

document.querySelector('body')
// not document.body, I think

let it try.