JavaScript and Cookies

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

31-Oct-02 00:00
This is a forum topic for discussing the article "JavaScript and Cookies":

http://www.elated.com/articles/javascript-and-cookies/

Learn how to manipulate cookies using JavaScript with this tutorial. Re-usable functions for easy cookie access are provided, for use in your own scripts.
04-Feb-11 12:33
Hi, i have autolike script, i need to add cookies to activate the script only ones for each visitor that click the like. how can i add cookies to this script. thanks
04-Feb-11 17:40
Please post your question in a new topic:

http://www.elated.com/forums/authoring-and-programming/topic/new/

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/
19-Sep-11 13:15
I see that this article was originally posted on Halloween of 2002, but have you been modifying this article as time goes by? Maybe js cookie functionality hasn't changed much since 2002, but do you generally update your articles when syntax changes or newer functionality is offered by browsers? i like elated, thanks
23-Sep-11 02:31
@cheapchop: Thanks for your comment! We don't generally update articles, except in special circumstances. We prefer instead to create new articles on the topic if it's changed a lot.

I don't believe JS's cookie handling has changed much since the article was written.

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/
07-Apr-12 09:55
https://developer.mozilla.org/en/DOM/window.escape

"escape" is not part of any officially recognized DOM standard. this tutorial should certainly be updated to use recognized DOM methods.

aside from that, this is a GREAT tutorial.

[Edited by Angry Black Man on 07-Apr-12 09:55]
09-Apr-12 14:52
window.escape????

Are you reading the same article as the rest of us?

escape() is a javascript METHOD/function for encoding special characters for use in URLs or in a HTTP request.
http://www.w3schools.com/jsref/jsref_escape.asp

It is not even used in the article as in it were part of the DOM specification.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/
09-Apr-12 16:06
Hi Chris,

"escape()"

is the same thing as

"window.escape()"

a lot of people are confused by this as you are. it's understandable. there are no "free standing" functions in javascript. all functions are attached to some object in some way in the DOM. everything in javascript is located within the DOM. everything.

the reason i mentioned escape was because of cheapchop's comments and the response he received by matt in which he declared that "I don't believe JS's cookie handling has changed much since the article was written". "much" is a subjective term, but in the interests of modern browser compatibility, this is certainly a valid, useful observation that would do well to be incorporated into an article like this.
10-Apr-12 08:45
""escape()"

is the same thing as

"window.escape()" "

No it is NOT! Maybe you don't quite understand the fundamentals of OOP.

window.name would refer to a property or method that is a member of (or belongs to) an object class, in this case the "window" object. Just as math.floor() is a member method of the math object.

escape() is a GLOBAL method/function that does NOT rely on the Document Object Model at all, it is part of the javascript interpreter.
The list of Global properties and methods are at -> http://www.w3schools.com/jsref/jsref_obj_global.asp and a list of member properties and methods of the window object is at -> http://www.w3schools.com/jsref/obj_window.asp


If escape() was a member of any object, it should/would belong to the string object, as it operates on a string of characters.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/

 
New posts
Old posts

Follow Elated