How does the browser relates the cookies for the websites opened in tabs.for example in firefox i have opened five tabs and in each tab i have loaded different sites. my question is how browser identifies which cookies for which site. what is the relationship it has. similarly if i open the same sites in another browser instance , will the same cookie be used.
Cookies are per-browser, but plugins (such as Flash) have their own storage and can be used to share information between browsers.
Cookies are specific to websites. If you have multiple tabs open to various pages on the same site they'll share cookies. Tabs open to different websites don't have access to cookies used by another site regardless of whether it's open in another tab.
The browser may store the cookie and send it back to the same server with later requests. Typically, an HTTP cookie is used to tell if two requests come from the same browser—keeping a user logged in, for example. It remembers stateful information for the stateless HTTP protocol.
No, if they are non-persistent cookies they are deleted upon closing the browser and if they are persistent they are saved on the hard drive but are only used by a single browser. IP addresses can change all the time or be identical for two different browsers, they no way uniquely identify a client.
How does the browser relate the cookies for the websites opened in tabs.
Cookies have nothing to do with tabs or windows -- they have to do with requests to a domain. Whenever the browser makes a request to a webserver for a domain, any cookies that it has for that domain will be sent in the request header. Often there are 10s of requests made for each webpage to download the HTML, images, javascript, etc.. Each of those requests get sent with the cookies for the domain in the request. Here's a good page about how cookies work in case you don't know.
If you have 5 tabs to different webpages then the requests made in those tabs to the various different domains will have different cookies. If some content (for example an image) is shared across all sites, then the same cookie will be sent in all of the 5 requests. If you open the same webpage in another tab in the same browser then the same cookies will be used for requests for that domain.
If you open another browser "instance" then it depends probably on the browser and your OS. If the cookie is not a session cookie, i.e. if the cookie is stored to disk, then when you run another instance of Firefox, it should read/write to the same cookie file as the first instance. Often if you start another browser it may just start another window of your current browser so the cookies will be the same. If you run two different types of browsers then most likely the cookies will be separate although it depends on the browsers on whether they share the same cookie files.
It's also important to understand that one of the features of the "Incognito Window" (Chrome) or "Private Window" (Safari/Firefox) is that they have a separate cookie space that gets removed when all private windows are closed. This means that you can log into two gmail accounts (for example) at the same time because the normal and private windows have different sets of cookies. This is also very useful when you want to test a web-service and you want to make sure to have clear cookies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With