0 Replies Latest reply: May 1, 2017 3:10 PM by Dicky Mohanty RSS

    Macro (JScript/VB) to extract the Browser Cookies/SMSESSION cookie

    Dicky Mohanty

      Hi All,


      I have a requirement to fetch the SMSESSION cookie from the browser, that will be used as one of the header in calling a WebService later.


      Went thru multiple sites to understand the code and also below are the sample codes to extract in browser console. But somehow those are not working in Macro edit pane.


      function readCookie(name){
      var nameEQ = name + "=";
      var theCookies = document.cookie.split(';');
      var aString = '';
      for (var i = 1 ; i <= theCookies.length; i++) {
      aString += i + ' ' + theCookies[i-1] + "\n";
      return aString;


      var x = document.cookie;


      If somehow that cookie value can be captured in variable or exported to notepad - that would be a help. Could someone please suggest?