Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

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

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;
window
.alert(x);

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

0 Replies