// Remote IFrame Detector
// version 0.1 
// 2007-01-19
// Copyright (c) 2007, Rod Hilton
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This script will look at any iframe in a document and draw
// a border around it if its source is on a different host.
//
// This helps prevent javascript malware attacks that rely on wrapping
// a safe site in an iframe to prevent detection.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name Remote IFrame Detector
// @description draw border around remote iframes
// @include *
// ==/UserScript==


var thishost = window.location.hostname;
var alliFrames = document.getElementsByTagName('iframe');
for (var i = 0; i < alliFrames.length; i++) {
	var thisiFrame = alliFrames[i];
	var src=thisiFrame.getAttribute("src");
	//Only bother if it's not a relative url, meaning it starts with http://
	if(src.search("^http://")==0) {
		var match=thisiFrame.getAttribute("src").search("http://"+thishost);
		//If the hosts don't match...
		if(match==-1) {
			thisiFrame.style.border="5px dashed red"
		}
	}
}

