5

if yes then what we can do with cookies?

Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

4 Answers4

6

You say static html, does this mean with javascript?

If so you can use javascript cookies to remember things like whether a menu was expanded, when the user last visited the site etc.

If you just mean pure html on its own then no, cookies can have no benefit to you and you can't write or access them.

Rob Stevenson-Leggett
  • 35,279
  • 21
  • 87
  • 141
  • 1
    The OP must mean with JS or as you note the question is rendered moot, being unable to create them in the first place – annakata Apr 03 '09 at 08:30
2

You can use cookies with client script. Look at document.cookie property. It contains all cookies that are accessible by script (i.e. all cookies not marked with HttpOnly flag). In fact you have to parse this string to separate cookies, but this is not hard at all.

Consult this article on how to work with cookies on client side.

XOR
  • 2,177
  • 1
  • 17
  • 15
0

You could display different elements of your site based on wether the current user has been there before or not.

This could be accomplished with javascript.

Andrei Serdeliuc ॐ
  • 5,828
  • 5
  • 39
  • 66
0

HTML is a markup language so it cannot read the cookie. But it you use javascript in your html you can create and read cookie and do what ever you want.

Bhushan Bhangale
  • 10,921
  • 5
  • 43
  • 71