2014-12-04 7 views
5

मैं HTML5 डेस्कटॉप अधिसूचना के साथ काम कर रहा हूं। यह अच्छी तरह से काम कर रहा है और मेरी आवश्यकताओं के अनुसार मुझे उचित आउटपुट दे रहा है। अब, मैं उस अधिसूचना को तब तक प्रदर्शित करना चाहता हूं जब तक कि उपयोगकर्ता उस अधिसूचना को मैन्युअल रूप से बंद न करे, यह कैसे संभव है कि मेरा कोड निम्नानुसार है।एचटीएमएल 5 डेस्कटॉप अधिसूचना के बंद समय को ऑटोक्लोज़ न करने के लिए कैसे बदलें?

function notifyMe() { 
     if (!("Notification" in window)) { 
     alert("This browser does not support desktop notification"); 
     } 
     else if (Notification.permission === "granted") { 
      var options = { 
        body: "due to your inactive response timer is stoped automatically. Start your timer again.", 
        dir : "ltr" 
       }; 
       var notification = new Notification("Your timer is stop",options); 

     } 
     else if (Notification.permission !== 'denied') { 
     Notification.requestPermission(function (permission) { 
      if (!('permission' in Notification)) { 
      Notification.permission = permission; 
      } 

      if (permission === "granted") { 
      var options = { 
        body: "due to your inactive response timer is stoped automatically. Start your timer again.", 
        dir : "ltr" 
       }; 
      var notification = new Notification("Your timer is stop",options); 
      } 
     }); 
     } 
    } 
+1

हाँ मुझे इसके लिए समाधान भी मिल रहा है। कहीं मुझे इस ऑटोक्लोज़ के लिए समाधान मिला है: 0 लेकिन अगर कोई समाधान हो तो यह काम नहीं कर रहा है, तो कृपया मुझे जितनी जल्दी हो सके दें। –

+0

संभावित डुप्लिकेट [फ़ायरफ़ॉक्स वेब नोटिफिकेशन को स्वचालित रूप से बंद करने से रोकें] (https://stackoverflow.com/questions/19144097/prevent-firefox-web-notifications-from-automatically-closing) – John

+0

उच्च गुणवत्ता वाले * और * पुराने का डुप्लिकेट पोस्ट: https://stackoverflow.com/questions/19144097/prevent-firefox-web-notifications-from-automatically- – John

उत्तर

4

यह क्रोम पर अनिश्चित काल तक रहता है। फ़ायरफ़ॉक्स में एक बग है जो इसे 4 सेकंड के बाद स्वतः बंद कर देता है: https://bugzilla.mozilla.org/show_bug.cgi?id=875114

+0

ठीक है, मुझे मिल गया है अब मोज़िला डिस्प्ले itme के लिए समाधान क्या है? और हाँ समाधान के लिए धन्यवाद। –

+0

एक कामकाज है, हालांकि यह थोड़ा गन्दा है। इसे देखें: https://bugzilla.mozilla.org/show_bug.cgi?id=875114#c34 – Riwen

+0

इन दिनों ओएस एक्स पर क्रोम स्वचालित रूप से 4 के बाद बंद हो जाता है। हो सकता है कि आप इसकी ऑनक्लोज़ विधि से जुड़ सकें और इसे फिर से शुरू कर सकें ... – rogerdpack

0

विकल्प में "आवश्यकताइंटरेशन" के साथ प्रयास करें, दोनों फ़ायरफ़ॉक्स और क्रोम में काम करेंगे। कोड है:

var options = { 
        body: "due to your inactive response timer is stoped automatically. Start your timer again.", 
        dir : "ltr", 
        requireInteraction: true 
       }; 
संबंधित मुद्दे