VasyaPetrov123, начни с манифеста manifest.json например:
{
"manifest_version": 2,
"name": "My extension",
"version": "1.0",
"description": "My extension's description",
"browser_action": {
"default_icon": "icon.png",
"default_title": "My extension",
"default_popup": "popup.html"
},
"permissions": [
"<all_urls>"
]
}
Затем popup.html например:
<!DOCTYPE html>
<html>
<head>
<title>My extension</title>
</head>
<body>
<input type="text" id="input"><button id="button">Button</button>
<script src="popup.js"></script>
</body>
</html>
И popup.js:
document.getElementById('button').addEventListener('click', function () {
var state = 'Go', query = document.getElementById('input').value;
chrome.browserAction.setBadgeText({ text: state });
// ...
// XMLHttpRequest and parse its response
// ...
// state = 'Yes' or 'No'
chrome.browserAction.setBadgeText({ text: state });
});