To display a visitor's screen resolution, simple include the following code in your page:
1 2 3 | <script type= "text/javascript" > document.write(screen.width+ 'x' +screen.height); </script> |
Screen resolution redirect
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 ;)
The script below will redirect users based on whether or not they have a monitor resolution of 800x600 or below:
1 2 3 4 5 6 7 8 | <script type= "text/javascript" > if ((screen.width<=800) && (screen.height<=600)) { window.location.replace( '<a href="http://example.com/800-600-or-less">http://example.com/800-600-or-less</a>' ); } else { window.location.replace( '<a href="http://example.com/greater-than-800-600">http://example.com/greater-than-800-600</a>' ); } </script> |
0 Comments