Page tree
Skip to end of metadata
Go to start of metadata

Debugging with JavaScript

javascript:moveTo(0,0);resizeTo(1024,768); - change the current browser window to the specified size. Without the moveTo depending on the location of the browser window it may constrain itself by the edge of the screen.

javascript:alert(document.cookie); - Shawn's trick to show all cookies in browser.

Explains the console - http://buildinternet.com/2010/12/debugging-javascript-behind-the-scenes/

Useful JavaScript Tricks

Resolution

In the browser address bar,

To determine the actual size of the browser window, use the following properties:

Internet Explorer (backward-compatibility mode):
document.body.offsetWidth, document.body.offsetHeight

Internet Explorer (standards mode, document.compatMode=='CSS1Compat'):
document.documentElement.offsetWidth, document.documentElement.offsetHeight

Most other browsers:
window.innerWidth, window.innerHeight

  • No labels