Cookies between Frames (same domain)

Posted on 2009-04-21
Last Modified: 2012-05-06
Hi there,

For some reason:
- I set cookie "username" in frame A using javascript, and frame B get the cookie just fine.
- I set cookie in frame B, but cannot read the cookie in frame A. Why?

Here's the frameset, in case that's important:
<frameset cols="70%,*">
  <frame name="bottom" src="results_frame.htm" scrolling="auto">
  <frame name="middle" target="bottom" src="work_frame.htm">

  <p>This page uses frames, but your browser doesn't support them.</p>

Question by:the_cyman
    LVL 63

    Accepted Solution

    If the two frame sources are different paths and the frame b is in some subfolder then it can read cookies from higher realm folder but cookies from frame b are visible only in subfolders.

    To prevent that behavior you have to set ;path=/; for both cookies and then you can read them from any subfolder of the web server root folder.

    LVL 63

    Expert Comment


    Author Closing Comment

    Amazing, thanks!

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Read about why website design really matters in today's demanding market.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now