OK this is interesting. I have am using a SCRIPT include on various sites which calls a PHP script on my main domain. For example on a.com I have this line: <SCRIPT src="http://www.b.com/script.php"></SCRIPT> OK that works fine, thats not the issue. My issue is that in script.php I want to set a cookie as follows: setcookie('accept','yes',time()+86400,'/','.b.com'); This works on Firefox perfectly but not on IE. On IE the cookie doesnt get set. I figured it might be a cross site scripting issue but it works with Firefox so wasnt sure. Any ideas?
I'm not sure what you're trying to do exactly but instead of calling <script try calling the page as an image. <img src="http://www.b.com/script.php" width="1" height="1" /> I know we used to do that a few years ago to set cookies on a different domain when some one logged in. I don't know if it still works though, depending on IE's security settings.
Hmm, can't you set a cookie simply via PHP itself? and script.php returning by example "alert('cookie set succesfully!');" ?
I do try and set the cookie in script.php In Firefox it works, but in IE it doesnt. Thats my question, anyone know why!!??
The php files headers must be a javascript file. Also you need to reload the page for the cookie to take affect in IE (not sure thou). Peace,
It is javascript and yes I know the page needs to be reloaded. My scripting works people.... like I said, it sets the cooking in Firefox but when I do the same thing in IE it doesnt. I am assuming it must be a security thing but I also noticed than when I refresh a page in IE it sets the Alexa cookie as well. In theory I am wanting to do the same thing, set a cookie for a different domain. Works in Firefix, just not IE.
I need to specify the domain. I am using: setcookie('accept','yes',time()+86400,'/','.domain.com'); Like I said it works in Firefox but NOT IE.
the domain you're using, does it have a underscore (_) in it? If so, that might be the problem, as I recently red after a bit of research IE has trouble with that. And does this works: setcookie('accept','yes',time()+86400,'/','.b.com', 1); PHP:
I am doing this: setcookie('accept','yes',time()+86400,'/','.b.com'); Code (markup): No the domain has no underscore.
And if you use setcookie('accept','yes',time()+86400,'/','.b.com', 1); PHP: Probably it doesn't makes difference, but maybe ..
That stands for "secure", as you'll find in the manual You could also try to make that "1" a "0" ... see what it gives.
i think its because P3P: http://www.w3.org/P3P/ Did u see a icon look like eye with a red cross at the bottom of IE browser(Privacy Report), it block your cookie? If yes definitely because of P3P, Platform for Privacy Preferences Project. You nee to install Compact Privacy Policy on your website. You need to add a header like this: header('P3P: CP="CAO DSP COR CURa ADMa DEVa TAIa IVAi IVDi CONi TELi OUR SAMi OTRi STP BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT PRE LOC"'); setcookie ("cookiename", "cookievalue", time()+(60*60*24*30), "/"); PHP: Don't ask me the meaning of the code above, because no one know it You can check with this header check website: http://www.delorie.com/web/headers.html Mine looks like this: HTTP/1.1 200 OK Date: Thu, 15 Mar 2007 11:19:55 GMT Server: Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b CP="CAO DSP COR CURa ADMa DEVa TAIa IVAi IVDi CONi TELi OUR SAMi OTRi STP BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT PRE LOC" X-Powered-By: PHP/4.4.4 Connection: close Content-Type: text/html Code (markup): Hope this help