I have a cookie that is being dropped by an external service into my web browser (for example named my_cookie), that I would like to access within Salesforce. However, according to the documentation the getCookies() method
Only returns cookies with the "apex__" prefix set by the setCookies method.
So when I try to access with the getCookies() method:
Cookie counter = ApexPages.currentPage().getCookies().get('my_cookie');
the counter value is null, because it expects the cookie name to be named apex__my_cookie
.
My only solution is to write a on page load javascript function that would copy my_cookie
into a cookie named apex__my_cookie
so it's accessible in Salesforce. Is this the only way to achieve what I want to do, or is there an alternative method I can use that doesn't require the javascript hack?