Document: beforescriptexecute イベント

非標準: この機能は標準ではなく、標準化の予定もありません。公開されているウェブサイトには使用しないでください。ユーザーによっては使用できないことがあります。実装ごとに大きな差があることもあり、将来は振る舞いが変わるかもしれません。

beforescriptexecute イベントは、静的な <script> が実行されようとするときに発行されます。このイベントは appendChild() のように動的に要素が追加された場合には発行されません。

構文

このイベント名を addEventListener() などのメソッドで使用するか、イベントハンドラーのプロパティを設定するかしてください。

js
addEventListener("beforescriptexecute", (event) => {});

onbeforescriptexecute = (event) => {};

イベント型

一般的な Event です。

js
function starting(e) {
  logMessage(`スクリプト実行開始 (ID:  ${e.target.id})`);
}

document.addEventListener("beforescriptexecute", starting, true);
// または
document.onbeforescriptexecute = starting;

ライブ例を表示

仕様書

BCD tables only load in the browser

関連情報