homepage Welcome to WebmasterWorld Guest from 54.204.215.209
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Block cookies/domains with JS or JQuery?
Is it possible to block cookie domains?
edgar996




msg:4389760
 9:47 am on Nov 22, 2011 (gmt 0)

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.

Thanks in advance!

Ed

 

enigma1




msg:4389771
 10:51 am on Nov 22, 2011 (gmt 0)

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?

penders




msg:4389776
 11:18 am on Nov 22, 2011 (gmt 0)

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.

edgar996




msg:4390345
 4:34 pm on Nov 23, 2011 (gmt 0)

Thanks for your replies. It's for a live site with very specific cookie policies.

I'll keep hacking away at the code and update this thread if I have a breakthrough...

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved