문서
/
HTML 파일 난독화
Pro
유료 플랜에서는 인라인 JavaScript가 포함된 HTML 파일을 난독화할 수 있습니다. 난독화 도구는 표시된 <script> 태그를 추출해 그 내용을 난독화하고 주변 HTML은 그대로 보존하며, 기본 난독화와 VM 난독화 모두에서 동작합니다.
HTML 파일 지원
Parse HTML 옵션을 활성화하면 난독화 도구가 <script> 태그를 자동으로 추출해 그 내용을 난독화하고 HTML 구조는 그대로 유지합니다.
예시
입력 HTML
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<script src="vendor.js"></script> <!-- External scripts preserved -->
</head>
<body>
<h1>Welcome</h1>
<!-- This script will NOT be obfuscated (no attribute) -->
<script>
console.log('Regular script - not obfuscated');
</script>
<!-- This script WILL be obfuscated -->
<script data-javascript-obfuscator>
// Self-contained code only!
function validateLicense(key) {
return key.length === 32 && key.startsWith('PRO-');
}
validateLicense('test');
</script>
<!-- Another obfuscated script (isolated from the one above) -->
<script data-javascript-obfuscator>
function init() {
console.log('App initialized');
}
init();
</script>
</body>
</html>
난독화 후에는 data-javascript-obfuscator 속성이 붙은 스크립트만 변환됩니다. 그 밖의 모든 내용은 그대로 유지됩니다.
제약 사항
data-javascript-obfuscator속성이 있는 스크립트만 난독화됩니다- 각 script 태그는 개별적으로 난독화됩니다. 코드는 독립적이어야 하며 다른 script 태그를 참조할 수 없습니다
- 이벤트 핸들러 속성(
onclick,onload등)은 난독화되지 않습니다 - JavaScript URL(
javascript:프로토콜)은 난독화되지 않습니다 - HTML 주석 안의 스크립트는 무시됩니다
- Parse HTML을 활성화하면 소스 맵은 지원되지 않습니다
