I'm wondering if it's possible to block a certain domain from setting a cookie by allowing users to select whether they want that cookie or not.
Example - User visits my site and sees a list of cookies my site uses. He selects the ones he will allow and rejects the others. The script will then only allow loading of the cookies he wants and either remove or block the unwanted ones.
I've tried it with some basic JS I found elsewhere but I'm only a novice coder and would appreciate some direction with this.
Theoretically is possible. You bring up a popup window with the cookies your server will send and ask the user to select which ones he wants. Then is up to your application how it will function with some, all or no cookies.
In reality now something like this will cause all kinds of problems. First the user doesn't necessarily know what each cookie does let alone if he understands about cookies in the first place. Then if he blocks the session cookie for example he may not be able to use certain pages of your site. You will need another tracking mechanism in this case, to identify if it's the same user (for example setting url identifiers).
If it's not for development purposes why would you want to confuse your visitors?
I'm wondering if it's possible to block a certain domain from setting a cookie...
Third party cookies? You wouldn't be able to block these without blocking the entire script or setting exceptions in the browser itself I would have thought.
For your own cookies... As enigma1 suggests, this does sound very problematic, unless perhaps you only presented a controlled subset of cookies to your users. You'd probably need some kind of cookie to store which cookies are blocked!? Unless your users are particularly concerned about which cookies are set (although I'm not sure why they should be) then it would perhaps be best to control functionality at a higher level.