header set set-cookie httponly;secure - How to set cookie secure flag using javascript

1 Answers

because the flag is called secure, not security:

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

how to set httponly cookie in javascript

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!