首页 > 其他 > 详细

[Tools] Create a Chrome Extension

时间:2018-09-16 17:13:16      阅读:199      评论:0      收藏:0      [点我收藏+]

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

原文:https://www.cnblogs.com/Answer1215/p/9656531.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!