Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

screen orientation and width&height

On mobile devices, if you open a keyboard then the above may fail, 
so can use screen.availHeight 
and screen.availWidth, which gives proper height and width even after 
the keyboard is opened.

if(screen.availHeight > screen.availWidth){
    alert("Please use Landscape!");
}

(screen.orientation || {}).type ||
    // @ts-ignore
    screen.mozOrientation ||
    // @ts-ignore
    screen.msOrientation;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #screen #orientation
ADD COMMENT
Topic
Name
7+4 =