Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Commonmark migration
Source Link

###Mozilla Developer Network explains various approaches:

Mozilla Developer Network explains various approaches:

MDN Async Script Techniques

<script async src="file.js"></script>

or

var script = document.createElement('script');
script.src = "file.js";
document.body.appendChild(script);

or if your JavaScript is in a String:

var blob = new Blob([codeString]);
var script = document.createElement('script');
var url = URL.createObjectURL(blob);
script.onload = script.onerror = function() { URL.revokeObjectURL(url); };
script.src = url;
document.body.appendChild(script);

There is also good information when async is not async as well as how to get around those cases.

###Mozilla Developer Network explains various approaches:

MDN Async Script Techniques

<script async src="file.js"></script>

or

var script = document.createElement('script');
script.src = "file.js";
document.body.appendChild(script);

or if your JavaScript is in a String:

var blob = new Blob([codeString]);
var script = document.createElement('script');
var url = URL.createObjectURL(blob);
script.onload = script.onerror = function() { URL.revokeObjectURL(url); };
script.src = url;
document.body.appendChild(script);

There is also good information when async is not async as well as how to get around those cases.

Mozilla Developer Network explains various approaches:

MDN Async Script Techniques

<script async src="file.js"></script>

or

var script = document.createElement('script');
script.src = "file.js";
document.body.appendChild(script);

or if your JavaScript is in a String:

var blob = new Blob([codeString]);
var script = document.createElement('script');
var url = URL.createObjectURL(blob);
script.onload = script.onerror = function() { URL.revokeObjectURL(url); };
script.src = url;
document.body.appendChild(script);

There is also good information when async is not async as well as how to get around those cases.

Source Link
user177800
user177800

###Mozilla Developer Network explains various approaches:

MDN Async Script Techniques

<script async src="file.js"></script>

or

var script = document.createElement('script');
script.src = "file.js";
document.body.appendChild(script);

or if your JavaScript is in a String:

var blob = new Blob([codeString]);
var script = document.createElement('script');
var url = URL.createObjectURL(blob);
script.onload = script.onerror = function() { URL.revokeObjectURL(url); };
script.src = url;
document.body.appendChild(script);

There is also good information when async is not async as well as how to get around those cases.

lang-js

AltStyle によって変換されたページ (->オリジナル) /