0

i want to that my java script file copy from server to client computer , and automatic Run Client pc java script file in every 1 hour Is it Possible or Not ?

  • 1
    It seems to me like you want to do something less than ethical - please explain in more detail what it is you want to do – Jaromanda X Aug 05 '16 at 05:15
  • i have use this script for notification [link](https://jsbin.com/ziwod/2/edit?html,js,output) here , it's working proper but notification not come automatically , so please check this – Gaurav Shrimali Aug 05 '16 at 05:17
  • 1
    put that code in a website, with appropriate changes of course - if your client wants to see notifications, they'll have to keep their browser on your website, and allow desktop notifications ... problem solved – Jaromanda X Aug 05 '16 at 05:21
  • yes i have checked , website host name added in browser notification list , but notification not generate automatically – Gaurav Shrimali Aug 05 '16 at 05:24
  • share your code **here** so someone who knows how to do these things may be able to help you. If your code doesn't work, and you wont share the code, how do you expect to get a fix for your code? – Jaromanda X Aug 05 '16 at 05:25

1 Answers1

0

 // request permission on page load
document.addEventListener('DOMContentLoaded', function () {
  if (Notification.permission !== "granted")
    Notification.requestPermission();
});

function notifyMe() {
  if (!Notification) {
    alert('Desktop notifications not available in your browser. Try Chromium.'); 
    return;
  }

  if (Notification.permission !== "granted")
    Notification.requestPermission();
  else {
    var notification = new Notification('Notification title', {
      icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
      body: "Hey there! You've been notified!",
    });

    notification.onclick = function () {
      window.open("http://stackoverflow.com/a/13328397/1269037");      
    };
    
  }

}
<button onclick="notifyMe()">
  Notify me!
</button>