Answer the question
In order to leave comments, you need to log in
How to make javascript code work in chrome extension?
All the best! Here I am trying to write my extensions for chrome, but I have a problem with the script.
here is my manifest:
{
"manifest_version": 2,
"name": "test", // Название расширения
"version": "1.0", // Номер версии
"description": "for test", // Описание расширения
"permissions": [
"tabs","http://*/*"
],
"content_scripts": [
{
"matches": [ "*://*/*" ],
"js": ["main.js"] . // мой js файл
}
],
"browser_action": {
"default_title": "test", // Название кнопки
"default_icon": "images/icon.png", // Иконка для кнопки
"default_popup": "popup.html" // Всплывающее окно
},
"options_page": "options.html" // Страница настроек
}
<!doctype html>
<html>
<head>
<title>test</title>
</head>
<body>
<script src="main.js"></script><!-- скрипт, выполняющийся при нажатии на иконку расширения-->
</body>
</html>
let a = document.getElementById('firstHeading').innerText;
console.log(a);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question