• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to retrieve cookie either through JSP or Javascript

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a requirement to delete a particular cookie on click of a hyperlink displayed on my site. On clicking this hyperlink on my website, a new window of another website pops up which creates and stores cookie on the client machine. But i am unable to retrieve the cookie (that was stored by the other website). I tried using document cookie call (with Javascript) as well as get cookies method of the request object (with JSP). If i check the list of cookies explicitly through the browser, i can see the same cookie with its value. But though my code, i am unable to retrieve it.

Can anybody shed some light on this and let me know how to read and then delete cookies (that are created by another website) through the Javascript code in my website.

Any help would be appreciated.

Thanks in advance !
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"perlavi",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by perlavi:
But i am unable to retrieve the cookie (that was stored by the other website).

Cookies are only available to the domains that created them.

how to read and then delete cookies (that are created by another website) through the Javascript code in my website.

You can't.
 
lavi mendonca
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear Bibeault for your quick response. Just to confirm, I won't be able to even read the cookies that have been created by another website, right ??

Thanks again.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right.
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I won't be able to even read the cookies that have been created by another website, right ??



Absolutely. When you use request.getKookie method, it tries to look for the cookies that are corresponding to your server. You can't control the stuff created by an other server.

Imagine, If that can be done, ... It means that you can control every website in the web.
[ May 28, 2008: Message edited by: Prasad Tamirisa ]
 
lavi mendonca
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you to both Bear Bibeault and Prasad for your inputs.
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic