Block site seen from horizontal

0

I'd like to know how I can block my site when viewed horizontally by mobile phone, when it can only be handled vertically.

It can be in JavaScript or PHP, but this should only happen with a mobile device.

NOTE: When I say block, I want to increase the script so that a message that says horizontal usage is disabled appears.

    
asked by anonymous 01.03.2016 / 10:30

1 answer

4

Original answer: SOen - forcing web- site to show in landscape mode only

<style type="text/css">
    #warning-message { display: none; }
    @media only screen and (orientation:portrait){
        #wrapper { display:none; }
        #warning-message { display:block; }
    }
    @media only screen and (orientation:landscape){
        #warning-message { display:none; }
    }
</style>

<div id="wrapper">
    <!-- conteudo do seu site aqui -->
</div>
<div id="warning-message">
    this website is only viewable in landscape mode
</div>

That is, if the user tries to view your page other than landscape mode, they will see a message instead of the content.

    
01.03.2016 / 12:36