jQuery Check if Window is in iFrame

Simple JavaScript code snippet to check whether or not a window is in an iFrame. Very useful for some functions that may make use of the URL in the address bar of the page.

Simple as this.

var isInIframe = (window.location != window.parent.location) ? true : false;

Also See: