在option中增加 reservedNames: ['^globalVariable1$'],假如你想要保留globalVariable1变量名不混淆。
<script type="text/javascript">
const obfuscationResult = JavaScriptObfuscator.obfuscate(
`
var you="11";
function test(){
let globalVariable1 = 'This will not be obfuscated';
alert(globalVariable1);
}
alert(you);
var globalVariable1 = 'This will not be obfuscated';
var globalVariable2 = 'This will be obfuscated';
`,
{
// 正则表达式匹配不被混淆的变量名
reservedNames: ['^globalVariable1$'],
compact: false,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
numbersToExpressions: true,
simplify: true,
stringArrayShuffle: true,
splitStrings: true,
stringArrayThreshold: 1,
debugProtection: true,
debugProtectionInterval: 2,
disableConsoleOutput: false,
domainLock:[] ,
domainLockRedirectUrl:'about:blank',
}
);
console.log(obfuscationResult.getObfuscatedCode());
</script> 网友回复
qwen3-omni-flash-realtime实时音视频对话如何记住上下文聊天历史记录?
lmarena.ai如何内置html代码直接预览功能?
qwen3-omni-flash-realtime官方vad python示例代码实时语音聊天没有声音?
如何抵御自定义SSID信标帧攻击?
如果使用网页来搭建一个与gemini的视频聊天通话系统?
gemini如果调用mcp服务?
如何接入多模态ai的api例如gemini或qwen Omni实现ai视频面试打分并保存面试过程?
如何在win10上开发一个自己的拼音输入法?
列式json与传统json有啥不同,如何相互转换?
在哪可以查看任意域名网站的每天的流量?


