/    Sign up×
Community /Pin to ProfileBookmark

Setting cookies in JavaScript?

Hi Guys

I think I have a really easy one for you.

I am currently using the following script to store information in cookies:

————-SCRIPT————–
<%
response.cookies(“prefs”)(“make”)=”Aston Martin”
response.cookies(“prefs”)(“model”)=”Vanquish”
response.cookies(“prefs”)(“price”)=”£40000″
For Each cookie in Response.Cookies
Response.Cookies(cookie).Expires = now()+365
Next
%>
————-END————-

This works just fine in my ASP pages but now I need to incorporate the same method into some xml pages and therefore believe I need to use Javascript. I have spent hours reading numerous (how to set cookies in Javascript) articles and have not found a simple example that matches what I want to achieve above.

Can anyone please put me out of my misery and provide me with a simple piece of code that I can use in my xml page to achieve the above?

If so, then that would be great.

I look forward to hearing from you

Rod from the UK

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @rjoseph spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...