What's the default setting for the expires attribute of the document.cookie property?
-
The duration of the browser session.
-
The duration the current document stays loaded.
-
Twenty-four hours from the time the cookie is set.
-
There is no default setting.
By default, cookies persist only for the duration of the browser session - they are deleted when the browser closes unless an explicit expires attribute is set. They don't default to 24 hours and do have a default setting (session duration).
If you set document.cookie without specifying an expires attribute, the cookie defaults to being a session cookie — it's kept only in memory and is discarded automatically when the browser session (all windows) ends. It is not tied to the document's lifetime, nor does it default to any fixed duration like twenty-four hours.