Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

UPDATE:

If you decide to use a method similar to the one outlined above, make sure you understand the potential security issues like a possibility of a cross site request forgery attack. Search Stack Overflow for JSONP securitySearch Stack Overflow for JSONP security to find more informations on how to make it safe. Keep in mind that the above explanation is a simplification of a somewhat complicated process that you need to understand. You have been warned.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

UPDATE:

If you decide to use a method similar to the one outlined above, make sure you understand the potential security issues like a possibility of a cross site request forgery attack. Search Stack Overflow for JSONP security to find more informations on how to make it safe. Keep in mind that the above explanation is a simplification of a somewhat complicated process that you need to understand. You have been warned.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

UPDATE:

If you decide to use a method similar to the one outlined above, make sure you understand the potential security issues like a possibility of a cross site request forgery attack. Search Stack Overflow for JSONP security to find more informations on how to make it safe. Keep in mind that the above explanation is a simplification of a somewhat complicated process that you need to understand. You have been warned.

more info on security issues
Source Link
rsp
  • 112.1k
  • 31
  • 210
  • 185

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

UPDATE:

If you decide to use a method similar to the one outlined above, make sure you understand the potential security issues like a possibility of a cross site request forgery attack. Search Stack Overflow for JSONP security to find more informations on how to make it safe. Keep in mind that the above explanation is a simplification of a somewhat complicated process that you need to understand. You have been warned.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

UPDATE:

If you decide to use a method similar to the one outlined above, make sure you understand the potential security issues like a possibility of a cross site request forgery attack. Search Stack Overflow for JSONP security to find more informations on how to make it safe. Keep in mind that the above explanation is a simplification of a somewhat complicated process that you need to understand. You have been warned.

link to a talk
Source Link
rsp
  • 112.1k
  • 31
  • 210
  • 185

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

It would be possible to directly share cookies if instead of abc.com, cde.com, def.com, you would have abc.xyz.com, cde.xyz.com, def.xyz.com, (google for subdomain cookies). Maybe it is possible to set your websites like that and still meet your requirements.

Otherwise, if all of those websites cannot be in subdomains of the same domain, then you may have one of them act as a central cookie server and when the user is on other domains you could use JSONP to direct them to some script on your cookie domain that would send you their id or whatever and make your script that handles the AJAX request set its domain cookie to the same value. Example:

  1. user visits def.com
  2. JavaScript code on def.com makes an JSONP request to abc.com
  3. abc.com sets a cookie if it is not set yet
  4. abc.com returns the cookie value as a response to the script on def.com
  5. script on def.com sets its local def.com cookie to the same value

and now your servers can coordinate their statistics etc.

All of this is of course possible only if all of the websites cooperate with each other, ie. your websites cannot mess with cookies of other websites that you don't control as well.

UPDATE:

See also Breaking The Cross Domain Barrier talk by Alex Sexton for some inspirations and code example.

added 385 characters in body
Source Link
rsp
  • 112.1k
  • 31
  • 210
  • 185
Loading
added 385 characters in body
Source Link
rsp
  • 112.1k
  • 31
  • 210
  • 185
Loading
Source Link
rsp
  • 112.1k
  • 31
  • 210
  • 185
Loading