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

HTMLScriptElement: supports() - Web API | MDN

MDN Web Docs

View in English Always switch to English

HTMLScriptElement: supports()

Baseline

20229

supports() HTMLScriptElement

true

js
HTMLScriptElement.supports(type)

type

"classic"

JavaScript

"module"

"importmap"

"speculationrules"

false

true false

HTMLScriptElement.supports()

js
const log = document.getElementById("log");

function checkSupport(type) {
  const result = HTMLScriptElement.supports(type) ? "true" : "false";
  log.textContent += `HTMLScriptElement.supports('${type}')  ${result}\n`;
}

if (typeof HTMLScriptElement.supports === "undefined") {
  log.textContent = "HTMLScriptElement.supports() ";
} else {
  // 
  checkSupport("module");
  checkSupport("classic");
  checkSupport("importmap");
  checkSupport("speculationrules");
  //  false 
  checkSupport("anything else");
}

HTML
# dom-script-supports-dev


Web Proxy Viewer  |  New URL  |  Original Page