如何使用html / js / php等检查是否已创建任何cookie?

I have been working on a chrome app recently, and need the functionality to alert the user by javascript msgbox when any cookies are created. The user will then have the option to accept or decline the cookie. I have experience in html, and a small amount in php, but do not knwo how to do this. Can anyone help? Thanks!

Either the cookie will be set via HTTP (in which case it will be too late for any client side JavaScript to prevent it being accepted) or it will be set by JavaScript, which will involve modifying document.cookie. Unless your code has been obfuscated, you can grep your JS codebase for cookie to find every time something goes to modify it and wrap it with a confirmation function. (There is no way to intercept changes to it programatically, but you could watch it on an interval, storing old values, and then set it back if it changes).