簡體   English   中英

好像瀏覽器處於隱身模式一樣發出獲取請求?

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

我正在使用 fetch 向給定的 url 發出獲取請求,可以說是 joe.com/123。 當我登錄網站和退出網站時,內容是不同的。 如何確保無論何時我向 url 發出請求,即使我已登錄,它也會返回與注銷響應一致的結果? 我嘗試將緩存參數添加到獲取請求中,將其設置為“no-cache”和“no-store”,但兩個值都沒有幫助 - 它返回登錄的響應。

都試過了 - 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);

我想到了。 這是未來肯定會有這個問題的人的答案。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM