function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

get the value in apex for a cookie

I need to get the button clicked time of the cookie inside an apex class.How can i achieve this??
<div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="mod" onclick="WriteCookie()">Close</button>                                                

      <script type="text/javascript">
            function WriteCookie()
               var now =;
               cookievalue = escape(document.myform.customer.value) + ";"
               document.cookie="name=" + cookievalue;
               document.cookie = "expires=" + now.toUTCString() + ";"
               document.write ("Setting Cookies : " + "name=" + cookievalue );

How can i get the values inside an apex class including the time on which the button was clicked..
I think cookies are only supported in sites and have to be set by the controller, not on the client.

This is a convoluted way of doing things though - if you want to send this information back to the controller why not use a hidden input field and let the platform do the lifting?