Jump to content

ila_rigo

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by ila_rigo

  1. <!DOCTYPE html>
    <html>
    <body>
    
    <p>Display "iphone" if the outherWidth is equal or less than 320px</p>
    
    <p id="demo">desktop</p>
    
    <script>
    
    function checkOuterWidth(){
    
    var w = window.outerWidth;
        
    if (w <= 320) {
       document.getElementById("demo").innerHTML = "iphone";
    }
    else {
       document.getElementById("demo").innerHTML = "desktop";
    }
    }
    
    </script>
    </body>
    </html>

    Hello,
    i am trying to write a function to detect the browser width and, based on that, have two different results. I have looked at some examples and tried to reproduce some tutorials but at the moment it doesn't work ... suggestions and corrections are very welcome

×
×
  • Create New...