There's a better way to do it.
From the Register:
Alexander Hanff, a privacy campaigner and programmer, says he has received a letter from the European Commission confirming that browser-side web scripts that pick out advert blockers access people's personal data (ie: the plugin stored on their computer). Thus, just like you need to give permission to EU websites to access and store your cookies, ad-blocker detectors must ask for permission before probing your browser.
©2013-2015 All rights reserved.