I managed to do it.
The problem is that we need to use the function set in a goog.net.Cookies
object.
There is already such an object, which is called goog.net.cookies, see the
bottom of the source file:

/**
 * A static default instance.
 * @type {goog.net.Cookies}
 */
goog.net.cookies = new goog.net.Cookies(document);

Therefore we need to do

(ns cookies
  (:require [goog.net.cookies :as cks]))

(defn ^:export setcookie []
  (.set goog.net.cookies "name" "content" -1))

Which will properly set the cookie (see attachment)


On Wed, Oct 5, 2011 at 11:24 PM, Eric Harris-Braun
<zippy.314....@gmail.com>wrote:

> Has anybody successfully used cookies in clojurescript with
> goog.net.cookies?
>
> I keep getting this error: 'this.isValidName' [undefined] is not a
> function" (Safari) or "Uncaught TypeError: Object [object DOMWindow]
> has no method 'isValidName'" (Chrome) when I try to set a cookie via
> goog.net.cookies.set.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

<<attachment: cookie_small.png>>

Reply via email to