I’m trying to prevent a user from disabling style.(I HAVE A GOOD REASON TO DO THIS, so please no posts about accessibility as 99.99% of my site is totally accessible. Just tryin to prevent on .1% of my pages. and if you must know it is a paid web course that i dont want people stealing…..easily).
Im using Jquery:
function cssCheck() {
if( ! $('#cssenabledcheck').is(':hidden') ) {
window.location.href = "www.somerandompage.com";
}
}
var styleCheck = setInterval(cssCheck, 500);
cssenebledcheck is an empty div with style set to hidden. The logic is if you disable styles, the div will show, and the style check will fail thus redirecting the user to a page telling them to enable styles. It is suprisingly non-memory-intensive even on old pc’s, even though it is continually running every half-second.
My question is, how easy is it for a person to override (inject) the styleCheck variable, thus beating my check? I truthfully know very little about hacking so any insight would be appreciated.
As easy as opening firebug and issuing
You should not assign the
setIntervalreturned value to a variable though, so it would be un-clearable.. But they could rewrite thecssCheckmethod.This in turn could be avoided by using an anonymous function
but they could disable javascript altogether, and there is nothing to do about that case..