After watching a YouTube tutorial on creating desktop notifications, I had an idea to use it as a reminder tool. For example, having a specific reminder appear as a desktop notification every 30 minutes when triggered by clicking a button. However, the code below only runs the setinterval method once when combined with the click event and fails to repeat. Any thoughts on how to fix this?
Here is a portion of the code in question:
<a href="#" id="trigger" onclick="notifyme()">Trigger</a>
<script type="text/javascript">
var myVar;
function showalert(){
var notify;
notify = new Notification('Reminder!',{
body:'How are you?'
});
window.location = '?message=' + this.tag;
}
function notifyme() {
myVar = setInterval(showalert, 5000);
}