Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Partner
Partner

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?

Tags (1)