I tried it with jQuery:
$.cookie('test', 'value', { expires: 7, path: '/', domain: 'test' });
but it won't work.
it's possible to do?
I tried it with jQuery:
$.cookie('test', 'value', { expires: 7, path: '/', domain: 'test.com' });
but it won't work.
it's possible to do?
Share Improve this question edited Jun 10, 2011 at 12:57 GeertvdC 2,9182 gold badges23 silver badges26 bronze badges asked Jun 10, 2011 at 12:32 MissCcMissCc 1311 gold badge1 silver badge3 bronze badges 4- 6 I'm guessing it won't work for a very good set of reasons, not the least of which is that being able to spoof cookies from another domain is a gaping security hole. – David Commented Jun 10, 2011 at 12:34
- I don't know if it's possible but I would be really surprised if you could! That would be a serious flaw! – Uphill_ What '1 Commented Jun 10, 2011 at 12:35
- 2 Can you do it using delphi from within the browser without the user being asked to execute an application on their local computer? Again, I'm guessing no. – David Commented Jun 10, 2011 at 12:37
- 1 There is a difference between code running in an application on your computer and code running in a webpage loaded from a website you visited. A big difference. – Quentin Commented Jun 10, 2011 at 12:37
3 Answers
Reset to default 12Nope, that will not work for security reasons.
It is not possible to do due to security reasons.
if you are in control of the 2nd domain there are some options to share your cookies described already here: What's your favorite cross domain cookie sharing approach?
Due to many people abusing it, most browsers block 3rd party either by default or by the user setting such a preference.
From Cookies:
Each cookie also has a domain and a path. The domain tells the browser to which domain the cookie should be sent. If you don't specify it, it becomes the domain of the page that sets the cookie, in the case of this page www.quirksmode.org. Please note that the purpose of the domain is to allow cookies to cross sub-domains. My cookie will not be read by search.quirksmode.org because its domain is www.quirksmode.org . When I set the domain to quirksmode.org, the search sub-domain may also read the cookie. I cannot set the cookie domain to a domain I'm not in, I cannot make the domain www.microsoft.com . Only quirksmode.org is allowed, in this case.