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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Debugging with JavaScript

javascript:moveTo(0,0);resizeTo(1024,768); - change the current browser window to the specified size. Note this is not 100% accurate display of what an end user will see.

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