一個Chrome插件包含以下幾個文件
- manifest.json。 配置文件故慈,名稱不可以更改昔馋,必須是manifest.json苟呐。
- icon.png梆惯。 插件logo,會顯示到Chrome 的右上角
- test.js。 js腳本文件
- test.html。插件UI界面
創(chuàng)建文件
localhost:~ wany$ cd ~/Desktop/
localhost:Desktop wany$ mkdir chajian
localhost:Desktop wany$ cd chajian/
localhost:chajian wany$ touch manifest.json
localhost:chajian wany$ touch test.js
localhost:chajian wany$ touch test.html
localhost:chajian wany$ ls
manifest.json test.html test.js
找一個icon.png 放入chajian文件夾辫封。
編輯內(nèi)容
manifest.json
{
"name": "alert",
"version": "1.0.0",
"description": "hahahaha",
"browser_action": {
"default_icon": "icon.png" ,
"default_title": "alert",
"default_popup": "test.html"
}
}
test.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>哈哈哈</title>
<script src="test.js"></script>
</head>
<body>
<button type="button" onclick="show()">Click Me!</button>
</body>
</html>
test.js
function show(){
var element = document.createElement("label");
var node = document.createTextNode("添加");
element.appendChild(node);
document.body.appendChild(element);
}
安裝
使用chorme訪問chrome://extensions/,將chajian文件夾直接拖到瀏覽器廉丽。
chrome 是博主的主瀏覽器倦微,因為世界各地的開發(fā)者為其開發(fā)很多好用的插件,可以在使用過程起到舉足輕重的作用正压,但也有很多個人開發(fā)和修改版的插件在新版chrome是無法正常使用欣福,今天我們就談?wù)勅绾伟惭b非chrome網(wǎng)上應(yīng)用店插件的安裝及使用,在這里我已unblock-tvb.crx擴展為例
chrome安裝unblock-tvb.crx擴展之后會每次啟動瀏覽器都會出現(xiàn)“請停用以開發(fā)者模式運行的擴展程序”的提示
image
)
http://cdn.zhangxuebing.cn/chromecrx6.jpg-watermarked.jpg
http://cdn.zhangxuebing.cn/chromecrx7.jpg-watermarked.jpg
添加成功之后焦履,即可看到組策略自動刷新
然后在管理模板的左側(cè)列表中找到經(jīng)典管理模板
Google -> Google Chrome -> 擴展程序
(這里有兩個Google Chrome用第一個就好拓劝,第二個里面也沒有 擴展程序 這一項)
[站外圖片上傳中...(image-90118b-1529466187307)] 雙擊打開“配置擴展程序安裝白名單,選擇已啟用 ->要從黑名單中排除的擴展程序id->顯示
添加在列表中輸入剛才記下的ID值 嘉裤,點擊確定
http://cdn.zhangxuebing.cn/chromecrx9.jpg-watermarked.jpg
然后重啟Chrome郑临,可以看到被禁用的擴展現(xiàn)在點擊“啟用”是有效的,搞定啦屑宠!