拦截JavaScript中的提取

发布于 2025-01-29 10:46:44 字数 718 浏览 0 评论 0 原文

得益于下面的JS代码,我可以检测到浏览器内部的所有获取。

const nativeFetch = window.fetch;
window.fetch = function (...args) {
    console.log('Getting some data...');
    return nativeFetch.apply(window, args);
}

因此,每次用户在我的应用程序内导航时,我都可以跟踪获取的内容。 不幸的是,它没有“拦截”下图(红色)上显示的最后一次提取。我不知道为什么。因为它从另一个域(*)获取?因为它被CORS政策阻止了吗?

(*)此获取来自另一个域:

您是否知道这是否可以在JavaScript中“检测”此提取?

在上面显示的脚本中,它检测到除此之外的所有获取。

I can detect every fetch inside my browser thanks to the js code below.

const nativeFetch = window.fetch;
window.fetch = function (...args) {
    console.log('Getting some data...');
    return nativeFetch.apply(window, args);
}

So every time user navigate inside my app, I can trace what is fetched.
Unfortunately it doesn't 'intercept' the last fetch showed on the picture below (in red). I don't know why. Because it fetch from another domain(*) ? Because it was blocked by CORS policy ?

(*) This fetch is from another domain: https://dev-123456.okta.com/oauth2/default/v1/authorize?client_id=12122...

Do you have any idea if this is possible to 'detect' this fetch in javascript ?

With the script showed above, it detect every fetch except this one.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文