微信安全 URL 优化代码 - 移除敏感参数
const wxSafeUrl = (url: string = location.href) => { const safeUrl = url .replace('https://h5p-gw.duotest.cn', 'https://h5.gogpay.cn/h5-test') .replace('https://h5p-gw.gogpay.cn', 'https://h5.gogpay.cn/h5') .replace(/(p=\w+&?)/g, '') .replace(/(openId=\w+&?)/g, '');
return safeUrl; }
原文地址: https://www.cveoy.top/t/topic/pe5J 著作权归作者所有。请勿转载和采集!