migroo Posted November 1, 2009 Share Posted November 1, 2009 Does the cookie go be for the document type and the html tag or after the document type but before the html tag?Thanks. Link to comment Share on other sites More sharing options...
boen_robot Posted November 1, 2009 Share Posted November 1, 2009 Neither... cookies are set either with JavaScript or by the server as an HTTP header. The exact method depends on the server side scripting language you have. In PHP for example, you have the setcookie() function. Link to comment Share on other sites More sharing options...
migroo Posted November 1, 2009 Author Share Posted November 1, 2009 Okay sorry I should be more specific.I am using PHP and the setcookie() function and am trying to find out if the setcookie() function should come before the document type or not.I know it goes before the html tag.Thanks Link to comment Share on other sites More sharing options...
boen_robot Posted November 1, 2009 Share Posted November 1, 2009 Okay sorry I should be more specific.I am using PHP and the setcookie() function and am trying to find out if the setcookie() function should come before the document type or not.I know it goes before the html tag.ThanksIt goes before ANY output. You mustn't have ANYTHING before you set a cookie. Not even a whitespace, let alone DTD or a tag.The reason for this is that, like I said, cookies are set as HTTP headers. And HTTP headers go before any ouput. Link to comment Share on other sites More sharing options...
migroo Posted November 1, 2009 Author Share Posted November 1, 2009 Okay thats what I needed to know.THANKS Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.