스크립트 후킹
후킹 함수
[code]
// 스크립트 후킹
/*
fun_new: 특정 함수가 실행 되기전 실행할 함수
fun_old: 특정함수가 실행된 후 실행할 함수
parent: 함수의 위치
Tip: fun_new 함수에서 return false;를 반환 하면 fun_old를 실행 하지 않습니다.
*/
function scriptHook(fun_new, fun_old, parent) {
if(typeof parent == 'undefined') parent = window;
for(var i in parent) {
if(parent[i] === fun_old) {
parent[i] = function() {
var Return = fun_new();
if(Return === false) return;
return fun_old.apply(this, arguments);
}
break;
}
}
}
[/code]
사용예제
[code]
function submiyAction() {
alert('저장됬습니다.');
}
function validAction() {
alert('검색 항목이 유효하지 않습니다.');
return false;
}
// 함수에 후킹 추가
scriptHook(validAction, submiyAction);
// 보통때와 같이 함수 실행
submiyAction();
[/code]
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5276 | 2년 전 | 1331 | |||
| 5275 | 2년 전 | 1401 | |||
| 5274 | 기타 | 2년 전 | 815 | ||
| 5273 | JavaScript |
swallow
|
2년 전 | 1045 | |
| 5272 | node.js |
swallow
|
2년 전 | 742 | |
| 5271 | JavaScript |
swallow
|
2년 전 | 1495 | |
| 5270 | PHP |
swallow
|
2년 전 | 844 | |
| 5269 | node.js |
swallow
|
2년 전 | 679 | |
| 5268 | node.js |
swallow
|
2년 전 | 1208 | |
| 5267 | PHP |
swallow
|
2년 전 | 1589 | |
| 5266 | MySQL |
swallow
|
2년 전 | 1088 | |
| 5265 | PHP |
swallow
|
2년 전 | 2029 | |
| 5264 | JavaScript |
swallow
|
2년 전 | 858 | |
| 5263 | 기타 |
swallow
|
2년 전 | 2980 | |
| 5262 | 기타 |
swallow
|
2년 전 | 667 | |
| 5261 | node.js |
swallow
|
2년 전 | 1059 | |
| 5260 | JavaScript |
swallow
|
2년 전 | 1508 | |
| 5259 | node.js |
swallow
|
2년 전 | 728 | |
| 5258 | node.js |
swallow
|
2년 전 | 1741 | |
| 5257 | node.js |
swallow
|
2년 전 | 1292 | |
| 5256 | PHP |
swallow
|
2년 전 | 1938 | |
| 5255 | node.js |
swallow
|
2년 전 | 684 | |
| 5254 | PHP |
swallow
|
2년 전 | 3011 | |
| 5253 | node.js |
swallow
|
2년 전 | 675 | |
| 5252 | 정규표현식 |
swallow
|
2년 전 | 621 | |
| 5251 | node.js |
swallow
|
2년 전 | 876 | |
| 5250 | PHP |
swallow
|
2년 전 | 1110 | |
| 5249 | node.js |
swallow
|
2년 전 | 1059 | |
| 5248 | PHP |
swallow
|
2년 전 | 1409 | |
| 5247 | node.js |
swallow
|
2년 전 | 1014 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기