Answer the question
In order to leave comments, you need to log in
How to call a Function from Chrome.Extension
There is a chrome extension in it there is a Content script
Inside it there is a function
on the site page there is a button
But Chrome writes that “alertme is not defined”
At the same time, the test alert triggered by onload in the content script works.
function alertme(){
alert("hi");
}
<input type="button" value="Hi" onclick="alertme()">
Answer the question
In order to leave comments, you need to log in
addEventListener to help you, and install it from the extension. Ato would be too major to drag data from extensions.
Impossible. Content scripts from extensions run in the sandbox and can only interact with the client script through the DOM (they share it).
That is: The
content script knows nothing about the variables and functions defined on the page.
The JS on the page knows nothing about the variables and functions defined by the content scripts.
All this is written more than once in the docks for Chrome extensions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question