title: Is it possible to block cookies from being set using Javascript or PHP?
body: <p>A lot of you are probably aware of the new EU privacy law, but for those who are not, it basically means no site operated by a company resident in the EU can set cookies classed as 'non-essential to the operation of the website' on a visitors machine unless given express permission to do so. </p>
  
  <p>So, the question becomes how to best deal with this?</p>
  
  <p>Browsers obviously have the ability to block cookies from a specific website built in to them.  My question is, is there a way of doing something similar using JS or PHP?</p>
  
  <p>i.e. intercept any cookies that might be trying to be set (including 3rd party cookies like Analytics, or Facebook), and block them unless the user has given consent.</p>
  
  <p>It's obviously possible to delete all cookies once they have been set, but although this amounts to the same thing as not allowing them to be set in the first place, I'm guessing that it's not good enough in this case because it doesn't adhere to the letter of the law.</p>
  
  <p>Ideas?</p>