How to require full screen mode in jQTouch app?

I use jQTouch to develop a website version optimized for iphone safari. The jQTouch demo shows how to display the “install this” message for users who do not use full-screen mode and hide them for those who are. When in full-screen mode, the body should have a class of "fullscreen". So you can hide the “install this” message for people who have already added your application to their homepage by adding this CSS rule to the stylesheet:

body.fullscreen #home .info {
    display: none;
}

I would like users to use the application only in full screen mode. When viewed from a normal browser, they should see only a message asking you to install the application. Of course, this message should be hidden otherwise.

It should be really, really simple, so I just have to skip something obvious.

I thought one way to do this would be to simply check the "fullscreen" class on the body: if it does not exist, use goTo to go to another div or hide other divs or something like that.

Strange, however, this does not work. As a test, I still have the original "info" message, as in the jQTouch demo, and it does not appear when starting in full screen mode. Thus, the body must have a full-screen class. And yet I can not find any other traces: when I put this warning to check things after loading the document, I get nothing when I start in full screen mode:

alert($("body").attr("class"));

I also thought that I could check fullscreen by checking the fullScreen boolean value. But that doesn't work either. What am I missing? What is the best way to do this?

+3
source share
1 answer

, , , - JQTouch Google , :

    if (window.navigator.standalone) {
   alert ('Thanks for launching this app your home screen')
} else {

   alert('Add this app to your home screen for the best experience')

} 
+2

Source: https://habr.com/ru/post/1736395/


All Articles