It needs an extra page and for that reason only works once, but you can have an onload= handler that makes a form submission of a hidden variable. This has to be done on an extra page before the real page because the form submission triggers a response from the server. If Javascript is enabled the onload event fires, if not, it doesn't.
But why do you need to know? Can't you just use a <NOSCRIPT> entity for its intended purpose?