[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/HTML/Reference/Elements/script#attributes [Back]  [Original]

<script>: - HTML | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

<script>:

Baseline Widely available *

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

* Some parts of this feature may have varying levels of support.

HTML- <script> JavaScript . <script> , GLSL WebGL.

Content categories , , .
, text/javascript.
.
ARIA-
DOM- HTMLScriptElement

In this article

.

async

, , , , src, .

: async , src . <script> , (.. async="false") . <script> (, , document.createElement) , (.. ) async="false".

crossorigin

script window.onerror , CORS. , (, , -, CSS- Javascript-), crossorigin. CORS .

defer

, , , DOMContentLoaded. defer DOMContentLoaded , .

: defer , src . async=false. defer , .

integrity

, () , . .

nomodule

, , , ES6- (.). , , JavaScript.

nonce

(, ) script-src Content-Security-Policy. , . , , .

src

URI ; .

: script src, .

text

textContent, . , textContent, , DOM.

type

. :

  • (-), MIME- JavaScript
    • : , " ", JavaScript-. MIME-, . MIME- JavaScript .
  • module
    • : , JavaScript-. . charset defer . module, JavaScript-. , CORS- .
  • importmap
  • : , . MIME, MIME JavaScript, . src .

charset

, "utf-8" ASCII. , charset, UTF-8, script .

language

type, . , type, language . type.

<script> async , defer type="module", , , .

text/javascript, , : (image/*); (video/*); (audio/*); text/csv. , error, load.

<script> HTML4 HTML5.

html
<!-- HTML4 -->
<script type="text/javascript" src="javascript.js"></script>

<!-- HTML5 -->
<script src="javascript.js"></script>

-

, module type, nomodule. , nomodule- .

html
<script type="module" src="main.mjs"></script>
<script nomodule src="fallback.js"></script>

Specification
HTML
# the-script-element


Web Proxy Viewer  |  New URL  |  Original Page