कई पेजों के लिए कुकीज़ सेट करने के लिए, आपको पथ को इस प्रकार सेट करने की आवश्यकता है:
;path=/
उदाहरण
उपरोक्त आपकी कुकीज़ को साइट कुकी बना देगा। कई पेजों के लिए कुकीज़ सेट करने के लिए निम्न कोड चलाकर देखें
लाइव डेमो
<html> <head> <script> <!-- function WriteCookie() { if( document.myform.customer.value == "" ) { alert("Enter some value!"); return; } cookievalue = escape(document.myform.customer.value) + ";"; document.cookie = "name=" + cookievalue + "; path=/"; document.write ("Setting Cookies : " + "name=" + cookievalue ); } //--> </script> </head> <body> <form name = "myform" action = ""> Enter name: <input type="text" name="customer"/> <input type="button" value="Set Cookie" onclick="WriteCookie();"/> </form> </body> </html>