anti-screenshot (Android + iOS) anti-screenshot (Android iOS) 手机防截屏或者虚化或是模糊处理页面Android 提供了系统级 API 来禁止当前 Activity 截屏只对当前 Activity 生效切换页面需重新设置无法阻止 root 设备或部分第三方工具的强制截屏。// 在你的 WebView 所在的 Activity 中添加 Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 禁止当前窗口截屏和录屏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_webview); }IOS 没有直接的 “禁止截屏” API监听截屏事件并做处理// 在 AppDelegate 或 WebView 容器中监听 [[NSNotificationCenter defaultCenter] addObserver:self selector:selector(userDidTakeScreenshot:) name:UIApplicationUserDidTakeScreenshotNotification object:nil]; - (void)userDidTakeScreenshot:(NSNotification *)notification { // 截屏后执行 // 1. 提示用户禁止截屏 // 2. 模糊/隐藏敏感内容 // 3. 上报风控系统 }使用 UITextField 遮挡敏感区域更强限制利用 iOS 系统对密码输入框的保护特性将敏感内容包裹在UITextField中并设置secureTextEntry YES系统会自动阻止对该区域的截屏和录屏。H5 辅助防护手段敏感内容模糊化当检测到页面失焦 / 进入后台时用filter: blur(8px)模糊页面核心内容。.sensitive-content { transition: filter 0.3s; } .blur { filter: blur(8px); }document.addEventListener(visibilitychange, () { if (document.hidden) { document.querySelector(.sensitive-content).classList.add(blur); } else { document.querySelector(.sensitive-content).classList.remove(blur); } });在页面上叠加半透明用户水印即使被截图也能溯源与原生端通信上报截屏事件到后台做行为风控任何防截屏方案都无法阻止物理拍照、录屏设备如外接相机。