Answer the question
In order to leave comments, you need to log in
How to pass the text selected in the tab to popup.html?
So far, I can only display the value of the variable from popup.js in popup.html.
popup.html:
<!DOCTYPE html>
<html>
<head>
<title>Расширение</title>
</head>
<body>
<button>
<script src="popup.js"></script>
</button>
</body>
</html>
{
"name": "Расширение",
"version": "0.1",
"manifest_version": 2,
],
"permissions": [
"tabs",
"http://*/",
"https://*/"
],
"icons": {
"32": "magnifier.png"
},
"browser_action": {
"default_title": "Расширение",
"default_icon" : "magnifier.png",
"default_popup": "popup.html"
}
}
var result = "Hello"
document.write(result);
chrome.tabs.executeScript( {
code: "alert(document.getSelection().toString());"
});
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