Locker Service document.cookie support

Support for document.cookie being writable (scoped to your own namespace, similar to how localStorage and sessionStorage work in Locker) is at the top of our queue and (Safe Harbor :p) is planned to be released before the auto-activation date to give you time to verify functionality.

I'll update this answer as progress is made.

Edit (Feb 13, 2017): Read/write support inside LockerService for cookies is currently scheduled to be released in a patch next week (Safe Harbor). Please note that you will only be able to read cookies your own namespace has written. Cookies created from other origins will be hidden inside your Lightning components.


Support for read/write has been added to Locker Service by Salesforce (thanks to @TrevorBliss for following up on that). However, the implementation does not work the same way as before Locker Service if your community uses a mix of Lightning and Visualforce. For example, if you have some pages that serve Visualforce PDF files, these pages will not have access to the cookies set by your Lightning Components (and vice-versa if your Visualforce pages are setting cookies using the Apex Cookie class.

This is a deal-breaker for me because we have a lot of back-end functionality built that expects those guest session cookies to be there in both contexts. To deal with this I have implemented a simple page to allow cookies to be transferred between Lightning and Visualforce formats.

If you are running into the same problem you can find the files at: https://gist.github.com/dsharrison/a417db2917f6238a1c386063e1c5d133.