T
T
Torento203452021-02-11 12:49:50
Google Chrome
Torento20345, 2021-02-11 12:49:50

How in js to refer to our index file for the extension?

How can I access my extension interface in Google Chrome, and how can I access the page itself in the browser?
It turns out that he does not find my button.

settings in json

{
  "manifest_version": 2,
  "name": "Words",
  "description": "Words",
  "version": "1.1",
  "browser_action": {
    "default_title": "ing",
    "default_icon": "icon.png",
    "default_popup": "index.html"
  },
  "content_scripts": [
    {
      "matches": [
        "<all_urls>"
      ],
      "js": [
        "main.js"
      ]
    }
  ],
  "permissions": ["activeTab"]
}


indexhtml
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Application</title>
<meta charset="UTF-8">

</head>
<body>

<h3>Поиск слов</h3>
<a class="myBtn">Найти</a>


<script src="main.js"></script>
</body>
</html>


js file
document.querySelector(".myBtn").addEventListener("click", searching);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question