Skip to content

antsanchez/cookie.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

cookie.js

Simple JavaScript code to set a cookie and write the value somewhere

Use

Link the script cookie.js.
Call the function writeCookieOnPlace(name_of_the_cookie_or_parameter, name_of_the_input_place_id) to:

  1. Check for the given paramenter or cookie. If the parameter exists, the cookie is saved (overwritten if exists).
  2. The value of the cookie is saved to the input with the selected id

Example

writeCookieOnPlace('affiliate', 'affiliateName')

  1. The code above will look for the parameter "affiliate" on the URL, like: http://yourweb.com/?affiliate=12345
  2. If if exists, will save the value to a cookie with the name "affiliate". If a cookie already exists with that name, it will be overwritten.
  3. If the parameter or the cookie exists, the value will be written on the value of the input field with the id 'AffiliateName'

About

Simple JavaScript code to set a cookie and write the value somewhere

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors