Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts

    implement cookie code on a web page

    hi _ i read the guidelines before submitting my question to this forum
    truth is i'm not sure if i'm in the right area or not

    i need to find a comprehensive guide to writing browser cookies which includes where the code is implemented into the page etc etc

    using codingForums as last resort after spending more than a week going through every channel i can think of _
    i've tried Amazon Lynda and loads more _ i can find snippets of information here and there _ examples of code to write
    but nothing that covers everything about this subject _

    any help or guidance anyone can give me would be gratefully appreciated
    and please accept my aqpologies if i'm in wrong area of the forum _ if you could point me to correct area i'll be happy to move

    thanks : )

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    974
    Thanks
    19
    Thanked 212 Times in 210 Posts

  • Users who have thanked DaveyErwin for this post:

    ifcDeveloper (08-06-2014)

  • #3
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DaveyErwin View Post
    thanks Davey _ i already went through W3C pages
    but what they don't tell you is where the code should be implemented!!
    as i said _ the snippets of code i can find pretty much everywhere but nobody deals with the background stuff
    i'm an accomplished HTML CSS designer _ kinda know my way around Javascript & jQuery
    what i really need is a beginner's guide _ start from scratch _ white sheet of paper etc on cookies

    thanks again for your fast response : )

  • #4
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts
    ok _ i think i found what i'm looking for _
    How to Use Cookies in JavaScript (thesitewizard.com)

  • #5
    New Coder
    Join Date
    Aug 2014
    Posts
    27
    Thanks
    0
    Thanked 1 Time in 1 Post
    " a cookie allows a site to store state information on your machine. This information lets a Web site remember what state your browser is in." Web sites use cookies in many several ways.
    JavaScript can create, read, and delete cookies with the document.cookie property.

    function set_cookie ( cookie_name, cookie_value,
    lifespan_in_days, valid_domain )
    {
    var domain_string = valid_domain ?
    ("; domain=" + valid_domain) : '' ;
    document.cookie = cookie_name +
    "=" + encodeURIComponent( cookie_value ) +
    "; max-age=" + 60 * 60 *
    24 * lifespan_in_days +
    "; path=/" + domain_string ;
    }

  • Users who have thanked janisspiker12 for this post:

    ifcDeveloper (08-19-2014)

  • #6
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts
    that is really kind of you to take the time to reply Janis _ thanks
    the bit i don't know is WHERE i should implement the code?
    should what you've written just be placed inside a <script> tag inside the header of an HTML document?
    Last edited by ifcDeveloper; 08-19-2014 at 10:42 AM.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •