NPAPI插件拦截网络请求?

发布于 2024-12-28 02:51:24 字数 164 浏览 2 评论 0原文

有没有办法创建一个 NPAPI 插件来拦截来自父浏览器的 Web 请求?我想看到 Chrome/Safari/IE/etc 正在请求 http://google.com/ 或其他内容,并且然后提供我自己对此查询的答复。

Is there a way to create a NPAPI plugin that intercepts web requests from the parent browser? I want to see that Chrome/Safari/IE/etc is requesting http://google.com/ or whatever, and then provide my own response to this query.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光清浅 2025-01-04 02:51:24

据我所知,你不能用 npapi 真正做到这一点。首先,浏览器使用您的插件的内容完全取决于 mime 类型。

其次,一旦浏览器决定使用插件 X 来显示某些内容,API 就不会向您提供一种方式来告诉浏览器您(插件)实际上并不希望显示该内容。在你的插件中实现一个完整的浏览器可能会起作用,但看起来非常矫枉过正,并且无疑会有很多警告。

如果我是你,我会考虑 chrome/safari/Firefox 扩展

As far as I know you can't really do this with npapi. Firstly what content the browser uses your plugin for is based solely on mime type.

Secondly once the browser has decided to use plugin X to display something the api doesn't provide you with a way of telling the browser that you (the plugin) doesn't actually want to display the content. Implementing a whole browser within your plugin might work but seems very overkill and would no doubt have many caveats.

If I were you I would be looking at chrome/safari/Firefox extensions

天冷不及心凉 2025-01-04 02:51:24

NPAPI 是不可能的,你似乎混淆了 < em>扩展和插件

NPAPI 允许您编写浏览器插件,这些插件嵌入在页面中或用于全页内容显示,以提供内容或脚本功能。最重要的是,插件必须显式嵌入到页面中或为特定的 mime 类型加载,并且无法控制其生命周期。

另一方面,扩展扩展了浏览器,可以独立于特定页面内容保持活动状态,并捕获导航等事件(详细信息取决于浏览器提供的扩展 API)。

It's not possible with the NPAPI, you seem to be mixing up extensions and plugins.

NPAPI allows you to write browser plugins, which are embedded in a page or used for full-page content display to provide content or scripting capabilities. Most importantly, plugins have to be explicitly embedded in pages or loaded for specific mime-types and don't have control over their life-time.

Extensions on the other hand extend the browser, can stay active independently of the specific page content and catch events like navigation etc. (details depend on the extension API the browser offers).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文