[Tools] Create a Chrome Extension

Posted answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Tools] Create a Chrome Extension相关的知识,希望对你有一定的参考价值。

Creating a Chrome extension requires a manifest.json file which defines how your extension will behave. With a minimal setup, you can already manipulate pages and change elements. This lesson walks you through creating a manifest.json file which will essentially "block" twitter and reddit and tell you to get back to work.

 

manifest.json:

{
    "name": "Back to Work!!",
    "version": "1.0",
    "manifest_version": 2,
    "content_scripts": [{
        "js": ["inject.js"],
        "matches": [
            "https://twitter.com/*",
            "https://*.reddit.com/*"
        ]
    }]
 }

 

inject.js:

document.body.innerhtml = `
  Back to Work!!
`

 

Go to chrome://extensions .

技术分享图片

 

Click "Load unpacked" folder.

 

Then when you visit twitter, it will show "Back to Work!!" in html.

以上是关于[Tools] Create a Chrome Extension的主要内容,如果未能解决你的问题,请参考以下文章

[Tools] Batch Create Markdown Files from a Template with Node.js and Mustache

Chrome development tools 笔记

Chrome Developer Tools:Network Panel说明

谷歌 Chrome Dev Tools 浅析 – 成为更高效的 Developer

[Tools] Create a Simple CLI Tool in Node.js with CAC

git - Trying to create a local repo of go.tools that is go get-able - Stack Overflow