How to set cookie secure flag using javascript



Answers

because the flag is called secure, not security:

document.cookie = "tagname = test;secure";
Question

I have tried to set a cookie using document.cookie = "tagname = test; secure" but this does not set the secure flag. Am I setting it wrong? Can you only set it from a server response? I am also wondering that, because I have had a difficult time finding an example of its use, that it probably is not commonly used?

Thanks a bunch!




Related