# JS筆記_script標籤中需不需要加type ---- ###### tags: `javascript` [如今还有没有必要在script标签中添加type="text/javascript"](https://segmentfault.com/q/1010000002804178) [Which is better: \<script type=“text/javascript”>…</script> or \<script>…</script>](https://stackoverflow.com/questions/4243577/which-is-better-script-type-text-javascript-script-or-script-scr) [text/javascript和application/javascript的差異 ](https://kingfff.blogspot.com/2012/08/textjavascript-vs-applicationjavascript.html) [Why write \<script type=“text/javascript”> when the mime type is set by the server?](https://stackoverflow.com/questions/2706290/why-write-script-type-text-javascript-when-the-mime-type-is-set-by-the-serve) 如題所述 有時不知道要不要加上type屬性 這次在寫code時有些程式範例也都有看到此規則 所以註明在這 總結論 因現代瀏覽器(使用Html5) 默認腳本就是Javascript 且標籤`<script>` 的默認就是 text/javascript 所以可以省略type不寫 type是 標籤中 腳本的類型 其默認是text/javascript ---- 一般不會註明屬性MIME ```htmlmixed= <script></script> ``` 註明屬性MIME ```htmlmixed= <script type="text/javascript"></script> ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up