Can I stop forced cookies in a hosting software

**Due to legacy hosting being removed from replit it has forced me to use drt hosting software (a software that goes into your google drive account and host the website for you for free(Dont worry its an alt I am not stupid enough to use my real email)) it without saying pre loads a bunch of tracking and bloat cookies I dont want any unnecessary cookies. Is there a way I can interfere with these cookies making them bug out or non functional? or s there a way to host a website better using something else to host. Its just a fun project I cant pay anything for software. I tried looking online about this unfortunately I was muddled by what I found I would really appreciate this help thank you. **

Has functioning cookies:

code or something to attack the cookies to make them break or non functional

Repl link:

code snippet

You can control how cookies are handled on your website from the client-side using JavaScript. Of course… this doesn’t stop the cookies from being set but allows you to manage them once they are on the client’s browser.
You can delete them or modify them like:

// delete
document.cookie = "cookieName=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";

// Modify
document.cookie = "cookieName=newValue; expires=date; path=/;";

You can use Netlify too they have a free tier.

1 Like

sorry for the delay in replying is there a way to be able to automatically get the code to change the time field so it always is automatically is targeting the cookie without me having to change it each day. also how would I go about finding its path please. Thanks so much for your help.

You can create a JS that dynamically calculates the dates, like a script that always sets the expiration time to a specific interval from the current time, for example:

document.cookie.split(";").forEach(function(c) {
    var cookieName = c.trim().split("=")[0];
    var expires = new Date(Date.now() + 1000 * 60).toUTCString(); // Cookie expires in 1 minute
    document.cookie = cookieName + "=modifiedValue; expires=" + expires + "; path=/";
});

This is kinda… tricky cause you have to know the path, in my example above you can see that I set the path as root: “/” (since it’s the most common), but if you already know the path you can just change it. But the code takes account for the two things (auto and path).

1 Like