how to get sessionID in html area component

  • How can i get the sessionID in the html area component , in the sidebar , using javascript without referring to the connection.js , Is this possible

  • Moti Korets

    Moti Korets Correct answer

    8 years ago

    Yes. It is stored in a cookie named sid so a

    var sid = document.cookie.match('sid=([^;]*)')[1];
    

    Should do the work. Or if you want something simpler to read

    var strCookies = document.cookie;
    var cookiearray = strCookies.split(';')
    for(var i=0; i<cookiearray.length; i++){
      name = cookiearray[i].split('=')[0];
      value = cookiearray[i].split('=')[1];
      if(name == 'sid')
         sid = value;
    }
    

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM