• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

thingsinjars/devtools-extension: Basic example of a Chrome Devtools extension wi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

thingsinjars/devtools-extension

开源软件地址:

https://github.com/thingsinjars/devtools-extension

开源编程语言:

JavaScript 100.0%

开源软件介绍:

DevTools Extension Example

This is a small boilerplate project to be used as a starting point for developing a Chrome DevTools Extension.

Installation

  • Open chrome://extensions
  • Enable 'Developer Mode' checkbox
  • Click 'Load unpacked extensions...'
  • Select the devtools-extension folder

Usage

While on any page, launch the devtools, you should see a new tab called 'DemoPanel' which contains 3 buttons.

Execute script in inspected page

Uses chrome.tabs.executeScript to execute an inline script in the context of the page you're inspecting (via background.html).

Insert script into inspected page

Uses chrome.tabs.executeScript to append an external file (included in the extension folder) to the inspected page (via background.html).

Insert button to send a message

With the grace of a gorilla, replaces the entire DOM of the inspected page with a button which has an onclick attached. Clicking the button will send a message from the inspected page to the background.html. It is then relayed back to the DemoPanel where it changes the text on the button.

Background

While working on a feature for GhostStory, I found myself trying to figure out how Chrome DevTools Extensions worked. Seeing as it took the best part of a day to actually get the basics in place (even using the docs and samples), I figure it might help to have a working example.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap