This repository was archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 438
Prevent execute html content before boomerang.js finished #47
Copy link
Copy link
Open
Description
situation is:
Javascript boomerang.js used as test of client net speed, problem is that html content is executed by browser and is not waiting for boomerang result. But boomerang result is needed because there are some changes in html content.
How it is possible to do not execute html content before boomernag.js has result?
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel='stylesheet' type='text/css' media='all' href='css/style.css' />
<link rel='stylesheet' type='text/css' media='all' href='css/colorbox.css' />
<script type="text/javascript" src="js/speedtest/boomerang.min.js"></script>
<script>
BOOMR.init({ beacon_url: "http://www.zzz.xx", user_ip: '10.0.0.1', site_domain: "http://www.zzz.xx", BW: { nruns: 3, base_url: 'http://www.zzz.xx/test_images/', cookie: 'SPEED-test'}});
</script>
<script type="text/javascript" src="js/preload.js"></script>
preload.js is just check cookies and if exist do not make test again, if does not, run speedtest by BOOMR.subscribe
var version_set=getCookie("speedtest_version_set");
if (version_set == "low"){
$(document).ready(website_init_low);
} else if (version_set == "high"){
$(document).ready(website_init_high);
} else {
BOOMR.subscribe('before_beacon', function(o) {
if(o.bw) {
netspeed = Math.abs(parseInt(o.bw*8/1024));
var netspeed_limit = 5000;
if (netspeed < netspeed_limit) {
document.cookie="speedtest_version_set = low";
$(document).ready(website_init_low);
} else {
document.cookie="speedtest_version_set = high";
$(document).ready(website_init_high);
}
}
});
}
Metadata
Metadata
Assignees
Labels
No labels