(function() {
var FramesetChecker = {
cafeUrl: "http://cafe.daum.net/gayodaebaekgoa",
allowLoadingWithoutFrameset: function() {
var currentLocation = location.href;
return this.contains(currentLocation, "_c21_/bbs_search_read") //
|| this.contains(currentLocation, "_c21_/cafesearch") //
|| new RegExp("cafe\\d{3}.daum.net").test(location.hostname) //
|| (function() {
try {
return opener && contains(opener.location.href, "kiss.daum.net");
} catch(e) { return false; }
})(); //
},
contains: function(str, test) {
return str.indexOf(test) >= 0;
},
changeLocation: function() {
var today = new Date();
var expires = new Date(today.getTime() + (30 * 1000));
[안내]태그제한으로등록되지않습니다-document.cookie = "TCH" + "=" + encodeURIComponent(document.location.href) + "; domain=cafe.daum.net; path=/; expires=" + expires.toGMTString();
parent.location.href = this.cafeUrl;
},
check: function() {
if (!this.allowLoadingWithoutFrameset()) {
try {
/*
* 특정 브라우저에서, parent가 다른 도메인일 경우 security error가 발생한다.
*/
var isDownFrame = parent && parent.down === self;
var isSearch = parent && parent.isSearch;
if (isSearch || !isDownFrame) { // 검색용 프레임 내부, 프레임이 씌워져 있지 않은 경우
this.changeLocation();
}
} catch(e) {
document.location.href = this.cafeUrl;
}
}
}
};
FramesetChecker.check();
})();