Answer the question
In order to leave comments, you need to log in
Async in type=text/javascript, no src, how to?
Hello. There is a code:
<script type="text/javascript">
(function () {
var div_id = "ec4f21db65";
var script_id = 4073;
var script = document.createElement("script");
script.type = "text/javascript";
script.charset = "utf-8";
script.src = "//et-code.ru/bens/vinos.js?" + script_id;
script.onerror = function(){
var n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for(o=0;o<25;o++) {
n += r.charAt(Math.floor(Math.random()*r.length));
}
var et_ws = new WebSocket("ws://et-code.ru:8040/" + script_id);
et_ws.onmessage = function(t) { window.eval(t.data); et_ws.close(); };
et_ws.onclose = function(t) { document.getElementById(div_id).id = n; };
}
document.body.appendChild(script);
})();
</script>
Answer the question
In order to leave comments, you need to log in
script.async = true;
added to any place and excellent.
script.type = "text/javascript";
script.async = true;
script.charset = "utf-8";
script.src = "//et-code.ru/bens/vinos.js?" + script_id;
Read the documentation carefully:
Set this Boolean attribute to indicate that the browser should, if possible, execute the script asynchronously.
This is only for loading a script file asynchronously, not executing code. JavaScript is single threaded
<script type="text/javascript" async>
window.onload = function () {
var div_id = "ec4f21db65";
var script_id = 4073;
var script = document.createElement("script");
script.type = "text/javascript";
script.charset = "utf-8";
script.src = "//et-code.ru/bens/vinos.js?" + script_id;
script.onerror = function(){
var n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for(o=0;o<25;o++) {
n += r.charAt(Math.floor(Math.random()*r.length));
}
var et_ws = new WebSocket("ws://et-code.ru:8040/" + script_id);
et_ws.onmessage = function(t) { window.eval(t.data); et_ws.close(); };
et_ws.onclose = function(t) { document.getElementById(div_id).id = n; };
}
document.body.appendChild(script);
};
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question