I've seen the following thread https://groups.google.com/forum/#!searchin/clojure/goog.net.cookies/clojure/zBzMDtiMIfA/88Y3Xiw4yDwJ
and thanks to the explanation there I can successfully set a cookie on localhost (I had to set the domain to 127.0.0.1). The Google closure page for net.Cookies (https://closure-library.googlecode.com/git-history/docs/class_goog_net_Cookies.html) describes the expiry date setting: opt_maxAge : number=The max age in seconds (from now). Use -1 to set a session cookie. If not provided, the default is -1 (i.e. set a session cookie). The code: (defn get-cookie "Returns the cookie after parsing it with cljs.reader/read-string." [k] (reader/read-string (or (.get goog.net.cookies (name k)) "nil"))) (defn set-cookie! "Stores the cookie value using pr-str." [k content & [{:keys [max-age path domain secure?]} :as opts]] (let [k (name k) content (pr-str content)] (if opts (.set goog.net.cookies k content) (.set goog.net.cookies k content (or max-age -1) path domain (boolean secure?))))) ;; Set the cookie here (set-cookie! "my-cookie" "xxx" {:domain "127.0.0.1" :max-age (* 60 2)}) ;; Display it here (js/alert (str "response: " (get-cookie "my-cookie"))) When I view the cookie in Chrome settings everything looks fine - apart from it always says it will expire at the end of the session and yet I'm trying to set the max-age (i.e. the expiry to 2 minutes from cookie creation) Any ideas why expiry isn't being set correctly? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.