Advertisement
Guest User

Resize

a guest
Jan 17th, 2013
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Resize</title>
  6. <script type="text/javascript">
  7. var viewportwidth;
  8. var viewportheight;
  9.  
  10. function resize() {
  11.     // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
  12.  
  13.     if (typeof window.innerWidth != 'undefined') {
  14.         viewportwidth = window.innerWidth,
  15.         viewportheight = window.innerHeight
  16.     }
  17.  
  18.     // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
  19.  
  20.     else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
  21.         viewportwidth = document.documentElement.clientWidth,
  22.         viewportheight = document.documentElement.clientHeight
  23.     }
  24.  
  25.     // older versions of IE
  26.  
  27.     else {
  28.         viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
  29.         viewportheight = document.getElementsByTagName('body')[0].clientHeight
  30.     }
  31.     if(viewportwidth >= 700) {
  32.     //window.reload();
  33.     alert("reload");
  34.     }
  35. }
  36. </script>
  37. </head>
  38.  
  39. <body onload="resize()" onresize="resize()">
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement