Skip to content

Commit

Permalink
Fix set cookie domain
Browse files Browse the repository at this point in the history
  • Loading branch information
yoriiis committed May 21, 2024
1 parent 1113347 commit 4feb958
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/assets/content-scripts/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getCookie(name) {
* @param {String} options.value Storage value
*/
function setCookie({ name, value }) {
const domain = window.location.host.split('.')
const domain = window.location.host
const isSecure = window.location.protocol === 'https:'

document.cookie = `${name}=${value}; path=/; domain=.${domain};${isSecure ? ' Secure;' : ''}`
Expand Down Expand Up @@ -54,7 +54,7 @@ function changeVariation({ testId, variationId, cookieValue }) {
* @param {String} options.value Cookie value
*/
function removeCookie({ name }) {
const domain = window.location.host.split('.')
const domain = window.location.host
document.cookie = `${name}=; expires=${new Date(0).toUTCString()}; path=/; domain=.${domain};`
}

Expand Down

0 comments on commit 4feb958

Please sign in to comment.