Я отправляю сообщение из contentscript во всплывающее окно и пытаюсь показать полученное сообщение при нажатии на расширение.
Я вижу, что сообщение получено только тогда, когда я Проверяю всплывающее окно
contentscript.js
console.log("content script");
chrome.runtime.sendMessage("hello",function(response)
{
console.log("sending message");
});
popup.js
console.log("popup script");
function onReq(request, sender, sendResponse)
{
ph=request;
console.log("msg: "+request);
document.getElementById("para").innerHTML = "msg: "+request;
}
chrome.runtime.onMessage.addListener(onReq);
всплывающее окно.html
<!doctype html>
<html>
<head>
<title>Example</title>
</head>
<body>
<div id="status"></div>
<p id="para">shows received message here</p>
</body>
<script src="popup.js"></script>
</html>
Я хочу получить сообщение и показать сообщение при нажатии, не открывая консоль. Как я могу этого добиться.