I've come up with this, but it doesn't work:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="/test.php?nocache=" + Date.now() + "></script>
</body>
</html>
It has to be part of the src
string. I believe I could do <script> console.log(Date.now()); </script>
if all I wanted to do was to output the Unix timestamp in the browser console, but that's not what I'm trying to do. I'm trying to prevent the /test.php
(which handles logging of page loads) from being cached by browsers, and since the page itself is not being served dynamically, I have to do it client-side.