Use a fetch request to set a cookie.
fetch-cookie by
topics-fetch-demo
ot-3p-src
javascript-cookie
example-b
samesite-b
samesite-a