document.cookie = "UserName=Paul; expires=Tue, 28 Dec 2020 00:00:00;";
<p>This page just created a cookie</p>
I open that file in MS Edge, there is no cookie. In FireFox, no cookie. In Chrome it shows a cookie, but with no description or name and nothing in it. In IE11, it shows a link to the file (it’s on my desktop) and when I open the “cookie” it contains:
“Cookies are no longer stored in files. Please use InternetCookie APIs to access cookies.”
According to the book, I should have a neat little cookie with the data in it.
I copied your code into my VSCode, saved as an HTML file, then was able to open it in both Chrome and FireFox (I am using a Mac so no MS Edge or Explorer 11 until I get my Windows machine back up).
In both I saw the title and the text “this page created a cookie”.
I found the cookie for Firefox easily in the WebDev tools/console. Took some doing to find it in Chrome (and had to google that) but it was there.
So not sure why it isn’t working on the Windows platform? DanCouper’s advice may be what you need though.