V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ufo22940268
V2EX  ›  问与答

为什么 tampermonkey 能够进行跨域请求并且带上 cookie

  •  
  •   ufo22940268 · Oct 4, 2022 · 1760 views
    This topic created in 1305 days ago, the information mentioned may be changed or developed.

    在 chrome 下,用 tampermonkey 的 GM_xmlhttpRequest 就能够在 A 网站跨域对 B 域名进行跨域请求,并且还能带上 cookie 。这是什么原理呢?因为 chrome extension 现在已经禁用了获取 cookie 的权限了,那 tampermonkey 应该也拿不到 cookie 才对。

    谢谢

    1 replies    2022-10-05 22:32:20 +08:00
    ysc3839
        1
    ysc3839  
       Oct 5, 2022   ❤️ 1
    “chrome extension 现在已经禁用了获取 cookie 的权限了”是错的。
    下载 Tampermonkey 4.18.0 的 crx ,里面的 manifest.json 的 permissions 是有 cookies 的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2340 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 05:17 · PVG 13:17 · LAX 22:17 · JFK 01:17
    ♥ Do have faith in what you're doing.