speedtest/example-singleServer-basic.html
Matthew Nickson e5496fcf90
Added Open "Source Code" link in a new tab #476
This just makes the links to the source code and Chart.js open in a new
tab. The `rel="noopener noreferrer"` has been added to prevent security
issues in older browsers. This is just an ease of use change that
doesn't affect any of the core speedtest functionality in any way.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2022-03-30 19:00:35 +01:00

39 lines
1.2 KiB
HTML
Executable file

<!DOCTYPE html>
<html>
<meta charset="UTF-8" />
<head>
<title>LibreSpeed Example</title>
<link rel="shortcut icon" href="favicon.ico">
</head>
<script type="text/javascript" src="speedtest.js"></script>
<body>
<h1>LibreSpeed Example</h1>
<h4>IP Address</h4>
<p id="ip"></p>
<h4>Download</h4>
<p id="download"></p>
<h4>Upload</h4>
<p id="upload"></p>
<h4>Latency</h4>
<p id="ping"></p>
<script type="text/javascript">
var s=new Speedtest();
s.onupdate = function (data) { // when status is received, put the values in the appropriate fields
document.getElementById('download').textContent = data.dlStatus + ' Mbit/s'
document.getElementById('upload').textContent = data.ulStatus + ' Mbit/s'
document.getElementById('ping').textContent = data.pingStatus + ' ms, ' + data.jitterStatus + ' ms jitter'
document.getElementById('ip').textContent = data.clientIp
}
s.start(); // start the speedtest with default settings
</script>
<a href="https://github.com/librespeed/speedtest" target="_blank" rel="noopener noreferrer">Source code</a>
</body>
</html>