[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/API/HTMLScriptElement [Back]  [Original]

HTMLScriptElement - Web API | MDN

MDN Web Docs

View in English Always switch to English

HTMLScriptElement

Baseline *

20157

*

HTML <script> HTMLScriptElement <script> HTMLElement

JavaScript text/javascript MIME (image/*) (video/*) (audio/*) text/csv error load

EventTarget Node Element HTMLElement HTMLScriptElement

HTMLElement

HTMLScriptElement.attributionSrc

<script> attributionsrc attributionsrc Attribution-Reporting-Eligible Attribution-Reporting-Register-Source Attribution-Reporting-Register-Trigger JavaScript

HTMLScriptElement.async

async true async true

HTMLScriptElement.blocking

<script> blocking

HTMLScriptElement.charset

charset

HTMLScriptElement.crossOrigin

script CORS

HTMLScriptElement.defer

defer true DOMContentLoaded defer

HTMLScriptElement.event

HTML

HTMLScriptElement.fetchPriority

high low auto <script> fetchpriority

HTMLScriptElement.integrity

<script> integrity

HTMLScriptElement.noModule

true ES JavaScript

HTMLScriptElement.referrerPolicy

HTML referrerPolicy

HTMLScriptElement.src

URL src <script> src

HTMLScriptElement.text

<script> Text Node.textContent

HTMLScriptElement.type

MIME <script> type

HTMLScriptElement.supports_static

true false

HTMLElement

HTMLElement

<script> <script> document.currentScript defer async

js
function loadError(oError) {
  throw new URIError(` ${oError.target.src} `);
}

function prefixScript(url, onloadFunction) {
  const newScript = document.createElement("script");
  newScript.onerror = loadError;
  if (onloadFunction) {
    newScript.onload = onloadFunction;
  }
  document.currentScript.parentNode.insertBefore(
    newScript,
    document.currentScript,
  );
  newScript.src = url;
}

document.currentScript <head>

js
function loadError(oError) {
  throw new URIError(` ${oError.target.src} `);
}

function affixScriptToHead(url, onloadFunction) {
  const newScript = document.createElement("script");
  newScript.onerror = loadError;
  if (onloadFunction) {
    newScript.onload = onloadFunction;
  }
  document.head.appendChild(newScript);
  newScript.src = url;
}

js
affixScriptToHead("myScript1.js");
affixScriptToHead("myScript2.js", () => {
  alert(' "myScript2.js" ');
});

HTMLScriptElement.supports_static

noModule

js
function checkModuleSupport() {
  if ("supports" in HTMLScriptElement) {
    return HTMLScriptElement.supports("module");
  }
  return "noModule" in document.createElement("script");
}

HTML
# htmlscriptelement


Web Proxy Viewer  |  New URL  |  Original Page