change website template if resolution is higher

Discussion in 'HTML - XHTML - CSS' started by wassup, Jan 23, 2009.

Thread Status:
Not open for further replies.
  1. wassup New Member

    Hello,

    Can anyone help with a suggestion or tips about how can i find the user resolution when enter on my website, and if that resolution is higher or lower (eg: or = 1024) then the image from header to change in another one?

    Thanks
  2. ishkey Mod - Designer

    Code:
    <script type="text/javascript">
    if ((screen.width<=1024) && (screen.height<=768)) {
    window.location.replace('http://example.com/1024-768-or-less');
    }
    else {
       window.location.replace('http://example.com/greater-than-1024-768');
    }
    </script>
    
    Once you know what a visitor's screen resolution is, you can redirect them to a particular page. Admittedly, you'd be better off with a page that worked at any screen resolution, but anyhow ;)
  3. wassup New Member

    Thanks ishkey
Thread Status:
Not open for further replies.