0

What we have are actually two sites: (site.com) developed inhouse, and (sub.site.com) which is open source. We're trying to make the two sites seem seamless as possible. There is a logout link in the (sub.site.com) site just for itself. I was hoping if it is possible for the user to be logged out of both (site.com) and (sub.site.com) when they click logout in the subdomain (sub.site.com).

Any ideas as to the best practice of implementing this? I tried using jQuery to do a $.get to call the logout link from the main site (site.com), but alas it doesn't seem to work. All I get is "failed to load resource".

2
  • 2
    Can you change it so site.com and sub.site.com use the same login cookie, which is set to site.com domain? Dec 29, 2010 at 22:44
  • +1 David Kemp; @SirrDon, see quirksmode.org/js/cookies.html -- scroll down to the "Domain and path" section.
    – Kai
    Dec 29, 2010 at 22:49

1 Answer 1

0

First of all, I would suggest looking into using some kind of SSO package to link the sites together. This would allow both sites to share authentication information and would get rid of the need to log into/out of each site separately. It's more work up front but it's the right way to solve this kind of problem.

If that isnt feasible though, your get/post idea should work, although you probably wouldn't be able to make it work for more than the two sites you have today. Most likely it's just a bad url or something like that.

You can also try replacing your javacript get with something like

window.location = "http://my-other-site.com/logout-url"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.