homepage Welcome to WebmasterWorld Guest from 107.21.163.227
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript Cookie - Append Query String to URL
how to append query string to URL from javascript cookie
keenboy




msg:3974085
 12:03 pm on Aug 18, 2009 (gmt 0)

Hi,

I need to be able to store the query string of group=trade in a cookie so it can be appended to a URL when the cookie has been found.

I don't have much experience with JS Cookies. I need the cookie to be placed on the users computer when they view our website. Then when they next visit the website the cookie is found and the query string is appended to the URL.

This is all for an affiliate scheme. The appended URL changes a small feature of the website.

Any help with this would be greatly appreciated.

Many Thanks,

 

whoisgregg




msg:3974156
 1:44 pm on Aug 18, 2009 (gmt 0)

Welcome to WebmasterWorld, keenboy!

Basically, it's just a matter of setting document.cookie:

document.cookie = "name=value; expires=date; path=path; domain=domain; secure";

There are many tutorials available with functions that make setting and reading cookies with javascript much easier though. I recommend a search in your favorite search engine for "javascript cookies." :)

Let us know if you run into any trouble and we'll be happy to help. :)

keenboy




msg:3974954
 1:30 pm on Aug 19, 2009 (gmt 0)

I think I now understand how to create the document cookie I just cannot seem to find much info on how to extract the query string from the cookie and append it to the URL.

Arno_Adams




msg:3974980
 2:58 pm on Aug 19, 2009 (gmt 0)

Hi,

Show us what you have so far...

Tom

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved