473,732 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I get cookies from other than the current path?

Using Javascript, you can call document.cookie to get a list of all the
cookies that will be sent to the path of the current document. Is
their a way to get all the cookies associated with the current domain
without regard to the path of the current document?

For example, if there is a cookie with path=/foo and a cookie with
path=/bar, and I have javascript in the page /foo/cool.html: Can I
query the cookie with the path of /bar as well as the cookie with the
bath of /foo? By default, document.cookie only returns the cookies
that would be sent with an HTTP request to /foo.

Thanks,
Dave

Sep 13 '05 #1
1 2143
On 13/09/2005 21:17, UncleStoner wrote:
Using Javascript, you can call document.cookie
Correction: you can read the property. It isn't a function.
Is their a way to get all the cookies associated with the current domain
without regard to the path of the current document?


No. That would be a security violation. Consider service providers and
hosts that assign users subdirectories not (sub-)domains. However, you
can assign a directory when setting the cookie (using the path
parameter) that is common to both documents.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Sep 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3880
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any new site I goto seems to prompt me to store their cookie. The other is Pocket IE on Pocket PC 2002, with the cookies set to 'enabled'. My problem is that the cookies dont seem to be being written with my ASP. I dont get the prompt to store...
7
2995
by: Brian Burgess | last post by:
Hi all, Anyone see anything wrong with the following: *************************************************************** <%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit Dim nAcctNbr Dim nMsgStart
2
3088
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own words, their own definitions plus an example of how the word is used in practice. It'll be all client side with - cookies? to get persistence so that the words won't disappear on me each time the page is closed (which is what happened when I
6
3055
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a cookie (say Response.Cookies ("TEST")) and you have a query string variable &test=x or &Test=x and you get Request.QueryString to parse the query string, the cookie that gets dropped matches the case of the query string, not what your code says. ...
12
2669
by: Patxi | last post by:
This is the first time I try to use cookies, and despite of reading some tutotials, I'm have real trouble to make it work correctly. My cookie reading code is in Master Page. When I click on a test button (in a WEb User Control inside the aspx page), cookie value is displayed in Master Page but if I go to another page, no value is displayed... I need to be able tu use cookie's value across all the site... What am I doing wrong ? Code...
5
1543
by: Kevin Blount | last post by:
I've setup a method (C#) that I can call, passing it a cookie name, then a name-value pair. The idea is that as I can't append to a cookie, I read the cookie value, append by name=pair to the end and write it back... which works fine for adding a single name-value pair on a page. The problem is, I want/need to add multiple name-values pairs, the number of which changing between pages (some might have 3, another 8). In my test scripts...
1
1391
by: Simon Wigzell | last post by:
I have discovered that saved cookie only apply to pages loaded from the directory in which they are set. That is, if you set a cookie from a page in your website domain root directory then load a webpage from a directory below the root then that page will not understand the cookie. And vice versa - if you set a cookie in a webpage in a sub directory of the root then it won't be understoon by pages in the root. This is in IE anyway, I have...
5
22578
by: pbd22 | last post by:
Hi. I am having a hard time figuring this one out... I have a sign in page. in my sign in logic, the successful login uses forms authentication and assigns an HttpCookie for the site-wide "user id" (ie. "Welcome BillG ! "). when the user clicks on "signout" from any given page, an XMLHttp call queries a server script (VB.NET) which
3
3164
by: Inny | last post by:
I want To offer a login Option, two Checkboxs, 1 labeled 'normal' the other labeled 'Forever'. I want to assign the check boxes to switch between the cookie script below (normal) and An altered version of the cookie script 'forever' Which will not expire but require deletion from the users pc. I need help to alter the cookie code below NOT to expire. I need help to write a javascript to switch between the two according to user prefrence...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.