Skip to content

Set cookies for multiple pages in JavaScript

Advertisements

To set cookies for multiple pages, you need to set the path as /.

path=/

Example

Advertisements
 document.cookie = "name=" + cookievalue + "; path=/";
See also  Set cookies to expire in 1 hour in JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.