I am working on a Chrome extension whose goal is to access a website in the background a display a specific value from it which the user should see by clicking on the chrome extension icon without having it to open the specific tab.
Here's my popup.html
:
<!doctype html>
<html>
<head>
<title>Notification Analyzer</title>
<script src="popup.js"></script>
</head>
<body>
<h1>Current Notifications</h1>
<a id="myLink" href ="https://website.com/notify/index.php"></a>
</body>
</html>
And my popup.js
:
a = document.getElementsByClassName('notificationArea').item('span').childNodes[6].textContent; // this is the value which I want to display on click of the extension icon
window.onload = function() {
document.getElementById("myLink").innerHTML=a;
} // Here, trying to add the value to the popup.html element
If I try to popup as an alert box on the specific website tab, it works. But not in background when the website tab is not open.
So two problems here :
How can I make the extension able to access the website contents in the background ?
How can I show the javascript content from popup.js in the popup.html