D
D
dllweb2017-05-31 14:22:23
JavaScript
dllweb, 2017-05-31 14:22:23

Calling functions or objects from the current open page context in an extension how?

Good time, dear, I'm interested in the question, how can I get the value of a variable from the context of the current tab with an open page? Suppose there is some function on js directly on this page, how can I call it from the content of the script in the extension? Get value, save and send to background?
Of the options - location.href = "javascript:somefunction();";
But in this case it will jump to the given .href
Variant with var command = "somefunction();" alert(eval(command)); also does not work - writes that the function is not defined, what should I do?

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