Hi!, thanks in advance to those who collaborate with me. =D
My questions is how to make $(uptime) updated in real time on the hotspot status page, without having to refurbish the browser.
Hi!, thanks in advance to those who collaborate with me. =D
My questions is how to make $(uptime) updated in real time on the hotspot status page, without having to refurbish the browser.
If you don’t want a page refresh, you might be able to create a JavaScript function that reads that value in a loop. I’ve not tested it, however.
Some example of its implementation?
Replace status.html with the contents of this HTML.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Status Page</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<script type="text/javascript">
function GetUptime()
{
// Get uptime value
var sUPTIME = '$(uptime)';
// if sUPTIME is not parsed, show current time, simply for testing
sUPTIME = new Date();
// Get access to element to show uptime
var eUptime = document.getElementById("UPTIME");
// refresh html element
eUptime.innerHTML = sUPTIME;
// wait 1 second and run again
setTimeout(function(){GetUptime()}, 1000);
}
</script>
</head>
<body onLoad="GetUptime()">
<div >
<p>Your current uptime:</p>
<p id="UPTIME"></p>
</div>
</body>
</html>
I apologize, remove these lines:
// if sUPTIME is not parsed, show current time, simply for testing
sUPTIME = new Date();
the value is still static
Does mikrotik support javascript to its full extent?
Can I use jquery?
Then with META tags or JavaScript, you’ll have to reload the page because it seems the embedded web server does not send down new data. If there is another way to query with JavaScript, I don’t know how.
If we could AJAX a php file, but I don’t think we can. Maybe with JavaScript AJAX, load an HTML file with the uptime in it, then parse the HTML output.