Majster
Majster

Reputation: 22

Chrome Notification on fullscreen / game

I have a problem and I cannot find any answers to my questions

  1. I have a question, is it possible to show notifications on fullscreen and in game? (Notification priority doesn't work)

  2. If the answer to the first question is impossible could I check if the user is in game or on fullscreen?

     function sendNotificationx(t, b, i, link) {
         var notification = new Notification(t, {
             body: b,
             icon: i,
         });
     }
    

Upvotes: 0

Views: 199

Answers (1)

Jericho
Jericho

Reputation: 174

Talking about notification, it probably depends how you will make it a screen overlay for the full screen if that's your target, however if you mean by a "notification" like the one that's found on the notification bar, you can't. That's the least that i know of.

There's a way particularly for firefox. 
The Document interface provides properties that can be used to determine if full-screen mode is supported and available, and if full-screen mode is currently active, which element is using the screen.

if((window.fullScreen) ||
    (window.innerWidth == 
    screen.width 
    && window.innerHeight == 
     screen.height)) {

    } else {

  }

Document.fullscreenElement / ShadowRoot.fullscreenElement
The fullscreenElement property tells you the Element that's currently being displayed in full-screen mode on the DOM (or shadow DOM). If this is null, the document (or shadow DOM) is not in full-screen mode.

document.fullscreenEnabled
The fullscreenEnabled property tells you whether or not it is possible to engage full-screen mode. This is false if full-screen mode is not available for any reason (such as the "fullscreen" feature not being allowed, or full-screen mode not being supported).

As well as let's say, it depends on the target platform your going to use.

Opera has 'Opera Show',

On the other hand you can use css Media queries - once the specific media query has been activated or matched as the full screen media query, you can call that a deal.

Mind as well check on other options Anytime soon, this post might be tagged as duplicate.

Upvotes: 1

Related Questions