i am looking to fetch the value of time from the id=time in background
and have that value displayed in place of tmee in the html shared.
if anyone can help i am working on a chrome extension.
when i click on the chrome extension it fetches a string in time format from a link in background and displays it if anyone can help? without using any external library Thank you
{
"manifest_version": 2,
"name": "whatever",
"description": "he he",
"version": "1.0.1",
"browser_action":{
"default_icon": "/images/icon.png",
"default_popup": "hehe.html"
},
"content_scripts": [ {
"matches": ["https://www.utctime.net/ist-indian-time-now"],
"js": ["hehe.js"]
}],
"background": {
"scripts": ["hehe.js"],
"persistent": false
}
}
getTime = () =>{
time = document.getElementById("time").innerHTML //this element from the utc website
sessionStorage .setItem('das2', time);
return time
};
document.getElementById("tmee").innerHTML = getTime();//not working
document.getElementById("tmee").innerHTML
=sessionStorage.getItem('das2');//not working
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="hehe.css">
<title>Whatever</title>
</head>
<body>
<div class="container">
<p>Time Counter :
<input id="h" type="number" max ="9" min="0" value="0" class="time">
<input id="m" type="number" max ="60" min="0" value="0" class="time">
<input id="s" type="number" max ="60" min="0" value="0" class="time">
</p>
<p>Completion Percentage: <a id="time1"> b </a> </p>
<p>Remaining minutes: <a id="tmee"> b </a></p>
<p>Position: a</p>
</div>
<script src="hehe.js"> </script>
</body>
</html>