HTMLScriptElement: async プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

asyncHTMLScriptElement インターフェイスのプロパティで、スクリプトの実行方法を論理値で制御します。クラシックスクリプトの場合、async プロパティを true に設定すると、構文解析と並列に外部スクリプトが取得され、利用できるようになるとすぐに評価されます。モジュールスクリプトの場合、async プロパティを true に設定すると、スクリプトとその依存関係がすべて並列に取得され、利用できるようになるとすぐに評価されます。

これは <script> 要素の async 属性を反映しています。

論理値です。

html
<script id="el" src="/example.js" async></script>
js
const el = document.getElementById("el");
console.log(el.async); // 出力: true

仕様書

Specification
HTML
# dom-script-async

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
async

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報