search

Home  >  Q&A  >  body text

javascript - How does jq get the browser status, whether it is zoomed in the taskbar, and whether it is on the current page

How does jq get the browser status and whether it is reduced to the taskbar

I want to make an H5 desktop notification, but I want it to wait until the browser is reduced to the taskbar. If it is in the expanded state, it cannot be triggered.

I don’t know if jq can do it, because I saw the web version of WeChat and smartqq are like this, but I don’t know if js can do it

阿神阿神2779 days ago563

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-05-19 10:26:55

    First determine whether it is in the current window

    if(window.document.hidden){ 
        //new Notification 
    }

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:26:55

    Isn’t it enough to just look at the source code?
    http://pub.idqqimg.com/smartq...
    The core code is this sentence:

    function isDocumentHidden(){
        return doc.hidden || doc.mozHidden || doc.webkitHidden;
    }

    reply
    0
  • Cancelreply