And, really, any domain that is hacking your site and/or doing a Denial Of Service attack is not going to be using a browser, anyway.
No, you don't want to even think about JS for this.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.