/    Sign up×
Community /Pin to ProfileBookmark

Cookie won’t set from master domain

We are using cookies to identify returning customers. Our application runs on our server but the main url calls a different server that in turn loads our app.

When we access the app directly from our server (using ip address + web_app + page) the cookie is saved and accessible when returning. However, when we access the app through the main url ([url]www.—.com[/url]) it will not set a cookie.

What do we need to do to set the cookie?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisMar 03.2003 — Some kind of server code. JavaScript cannot access cookies from another domain. It's a security limitation. You are probably writing the cookie, you just cannot read it from the other domain.
Copy linkTweet thisAlerts:
@mkistlerauthorMar 03.2003 — Thanks for your quick reply. I'm pretty sure it's not posting at all. I know where my cookies are kept, and nothing is written or updated when connected to the main url.
Copy linkTweet thisAlerts:
@gil_davisMar 03.2003 — Post a link.
Copy linkTweet thisAlerts:
@mkistlerauthorMar 03.2003 — Master URL Connect - http://www.dfwbmwdirect.com/cookiemonster.htm

Direct Connect -

http://209.220.230.133/evps_bmw/cookiemonster.htm

These links access exactly the same page.
Copy linkTweet thisAlerts:
@mkistlerauthorMar 03.2003 — NOTE: My browser caches the page, so if I don't reload it fresh, it appears to read the values.
Copy linkTweet thisAlerts:
@gil_davisMar 03.2003 — You didn't tell me it was in a frame.

I cannot prove this (I don't know how to prove it), but I believe you are still having security problems. Frames will inhibit Javascript across domains. The javascript in the frame exists in a different domain than the frameset itself. I don't think you get another set of cookies.
Copy linkTweet thisAlerts:
@mkistlerauthorMar 03.2003 — Thanks Gil. The frameset on the server is unfortunately not our property, but we will follow up on this with our customer and find out why they need to use the frames. I see no good reason for it. I appreciate the insight and will let you know what we discover.
Copy linkTweet thisAlerts:
@mkistlerauthorMar 04.2003 — I fixed it! Thank you for your help. The frame was indeed the problem. Even though I have no access to the original frame, I found that I could redirect myself with a page that contains only "top.location.href=" and the name of the original page we want. I don't know why, but the original frameset is gone and cookies are available.

Thanks again for the direction.
×

Success!

Help @mkistler spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...