简体   繁体   English

Chrome扩展程序,获取当前标签的标题

[英]Chrome extension, get headers of current tab

I know chrome.webRequest.onHeadersReceived but it gives me only headers from request executed by my extension. 我知道chrome.webRequest.onHeadersReceived但它只给我扩展程序执行请求的标头。

Instead of doing another request in background, I would like to get headers of my selected tab from chrome. 我希望从Chrome中获取所选标签的标题,而不是在后台执行其他请求。

Is it possible ? 可能吗 ?

The chrome.webRequest APIs observe all HTTP requests that your extension has permissions for, not just ones made by your extension. chrome.webRequest API会观察您的扩展程序具有权限的所有HTTP请求,而不仅仅是您的扩展程序所做的HTTP请求。

If you're not seeing the requests you expect to see, one of the following may be the case: 如果您没有看到您希望看到的请求,则可能出现以下情况之一:

  1. The extension is being loaded (or installed) after the page has already loaded. 在页面加载后加载(或安装)扩展。 The Web Request API can only observe requests that are currently occurring, not ones that occurred in the past. Web Request API只能观察当前正在发生的请求,而不是过去发生的请求。

  2. Your extension doesn't have permissions for the page. 您的扩展程序没有该页面的权限。 Give it permissions. 授予权限。

  3. You are trying to observe requests made by a protected page, like the Chrome Web Store. 您正在尝试观察受保护页面(如Chrome网上应用店)发出的请求。 You can't do that. 你不能这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM