tabs.executeScript() 您所在的位置:网站首页 谁知道山东的所有的三甲医院的名单 tabs.executeScript()

tabs.executeScript()

2023-04-09 15:41| 来源: 网络整理| 查看: 265

Injects JavaScript code into a page.

Note: When using Manifest V3 or higher, use scripting.executeScript() to execute scripts.

You can inject code into pages whose URL can be expressed using a match pattern. To do so, its scheme must be one of: http, https, or file.

You must have the permission for the page's URL—either explicitly, as a host permission—or, via the activeTab permission. Note that some special pages do not allow this permission, including reader view, view-source, and PDF viewer pages.

You can also inject code into pages packaged with your own extension:

browser.tabs.create({url: "/my-page.html"}).then(() => { browser.tabs.executeScript({ code: `console.log('location:', window.location.href);` }); });

You don't need any special permissions to do this.

You cannot inject code into any of the browser's built-in pages, such as: about:debugging, about:addons, or the page that opens when you open a new empty tab.

The scripts you inject are called content scripts.

This is an asynchronous function that returns a Promise.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有