Jump to content

GetCookies from javascript to PHP


anujgarg

Recommended Posts

A browser automatically sends cookies to the web server (where php can access them in the $_COOKIE array) that have settings that match the http/https protocol, hostname, domain, and path of the URL that is being requested and javascript cannot access any cookie that does not have settings that match the current page the javascript is running on due to the "same origin" security - http://en.wikipedia.org/wiki/Same_origin_policy

 

So, matching cookies are already available to php and non-matching cookies cannot be accessed anyway.

 

What exactly are you trying to do?

I had a situation like this a while back, where I wanted a javascript CSS stylesheet switcher that sets a cookie, that could then be picked up by PHP on other pages. I never found a solution though :(

 

----------------

Now playing: Dance Gavin Dance - 12 Hours, 630 Miles

via FoxyTunes

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.