Saturday 28 October 2023

same cookie notice reappears on subdomain despite it was accepted

I'm encountering an issue where, despite accepting cookies on the primary localhost, the cookie notification persists when I move to a subdomain such as requester.localhost. Same with if I accept cookies on a subdomain, the notification shouldn't show up again on the primary localhost (without a subdomain), yet it does.

Here is the script:

export default {
  data() {
    return {
      snackbar: true,
      timeout: -1,
    };
  },
  computed: {
    cookieAgreement() {
      return this.$cookies.get("cookie_agreement") === "1";
    },
  },
  created() {
    if (this.cookieAgreement) {
      this.snackbar = false;
    }
  },
  methods: {
    acceptCookies() {
      this.$cookies.set("cookie_agreement", "1", {
        path: "/",               // Set the path to root to make it accessible across the entire domain
        domain: ".localhost" // Set the domain to make it accessible across subdomains
      });
      this.snackbar = false;
    },
  },
};


from same cookie notice reappears on subdomain despite it was accepted

No comments:

Post a Comment