SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Speed of checking cookie's name

    If I want to check whether guest has a cookie named "mysettings" using the following method.

    Code JavaScript:
    if(document.cookie.match("mysettings"))
    I once wonder if the checking speed will be seriously slow down when guest's computer has stored a lot of cookies, but since this method checks cookie that was set at the same domain, so this is always the fastest method. Right?

    When the website has more than 100 pages and guest has to do this checking on every page, is this method efficient?

  2. #2
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Checking a user's cookies with JavaScript will not have a serious impact on the performance of your site.

    But this sort of thing is best done server-side (PHP, ASP.NET etc.) without relying on JavaScript being enabled.

  3. #3
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see. Thank you, trib4lmaniac.


Bookmarks

Posting Permissions

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