Forum Discussion

raouldelange's avatar
7 years ago

Set cookie preferences

Hello,

We would like to give an option to our customers to set their cookie preferences (level 1,2,3,4). I have read that users can do this manually by changing their browser settings. However, we would like to develop something with which they can do it in an interface.  I have two questions:

1. Are there functions in Lithium we can use to change cookie preferences? (If not, can we expect this in the near future?)
2. A temporary solutions for us would be to disable all cookies classified with a '4'. Is there a way in which we can achieve this?

I hope you can help us find a solution.

Kind regards

 

1 Reply

  • raouldelange

    There is no such way at the moment to set cookie preferences on the basis of different level.

    But you can add cookie using http.client.request on different url.

    http.client.request("protocol", "host", "url").cookie(cookie)Adds a cookie to the HTTP client request builder. Use http.request.createCookie("name", "value") to create a
    javax.servlet.http.Cookie object to pass in.
    13.4
     <#assign remember_login_cookie = http.request.createCookie("rem_login", "johnD") /> lithium js sdk<#assign http_client_request =
    http.client.request("http", "www.somewebservicedomain.com", "/some/web/service")
    .cookie(remember_login_cookie) />`