How to update this code every 5 seconds ?. I need that when the user changes his fingerprint, the code is updated without the need to update the page, and that the cookie with the value of the new fingerprint is created.
<center> Tu Huella Digital es: <div id="fp2"></div></center>
<script src="fingerprint/fingerprint.js"></script>
<script>
var fp2 = new Fingerprint({canvas: true});
document.getElementById('fp2').innerHTML = fp2.get();
</script>
<script>
var fn = document.getElementById('fp2').innerHTML;
var cookieName = 'fingerprint';
var cookieValue = fn;
var myDate = new Date();
myDate.setMonth(myDate.getMonth() + 12);
document.cookie = cookieName +"=" + cookieValue + ";expires=" + myDate;
</script>