Manifest file - json format file.
HTML - user interface of extension.
JAVASCRIPT, CSS, Images should also be included in this extensions directory.
2. The Manifest File
file name: manifest.json{
"manifest_version": 2,
"name":"Hello World",
"description":"this is my first chrome extension",
"version":"1.0",
"browser_action": {
"default_icon":"icon.png",
"default_popup":"popup.html"
}
}
3. HTML Files
<!doctype html>
<html>
<head>
<title>Hello World</title>
<script src="jquery-3.2.1.js"></script>
<script src="popup.js"></script>
<link rel="stylesheet" type="text/css" href="popup.css">
</head>
<body>
<h1 id="greeting">Hi!</h1>
<input id="name" type="text">
</body>
</html>
4. Adding The Icon
Any icon that you wan.
5. JavaScript
Also you need import iquery.js library.
$(function() {
$('#name').keyup(function() {
$('#greeting').text('Hi, ' + $('#name').val() + '!');
});
});
6. Adding Style
h1{
color:blue;
}
0 nhận xét:
Đăng nhận xét