I had the same question a while ago, but about a standard html site.
I used a simple piece of code in the html header and a js file. I know nothing about js but apparently it's an acceptable solution. I use this on http://www.insegnanti-inglese.com/ and if I check the page with http://validator.w3.org it gives me the green light. No idea if or how this would work inside moodle though....
See the attached txt file.
Brian