Making a get request as if the browser is in incognito mode?

Viewed 484

I'm making a get request using fetch to a given url that lets say is joe.com/123. The contents are different whenever I'm logged into the website versus when I'm logged out of the website. How do I ensure that anytime I make the request to the url, even if I am logged in, it returns a result that is consistent with the logged out response? I have tried adding to the fetch request the cache parameter, setting it "no-cache" and "no-store" but both values did not help - it returns the logged in response.

Tried both - fetch(bruh, {cache:"no-cache"}) & fetch(bruh, {cache:"no-store"})

    bruh = window.location.toString();
    bro = await fetch(bruh).then(result =>result.text()).then(text=>text);
1 Answers

I figured it out! Here's the answer for future people that will surely have this question.

fetch('https://example.com', {credentials: 'omit'});
Related