在 Safari/WebView 中禁用 XSS 过滤器 [英] Disable XSS filter in Safari/WebView

查看:60
本文介绍了在 Safari/WebView 中禁用 XSS 过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用于 XSS 检查的工具,使用 Webkit WebView 和 Macruby.这很好用,除了偶尔 Safari 的 XSS 过滤器会捕获我的 URL 并拒绝执行恶意脚本.有没有办法禁用此功能,最好以编程方式?

I'm developing a tool for XSS checking, using the Webkit WebView and Macruby. This works great, except that occasionally Safari's XSS filter catches my URLs and refuses to execute evil scripts. Is there a way to disable this functionality, preferably programatically?

推荐答案

所以经过一番挖掘,我找到了解决方案.WebPreferences 上有一个未记录的私有方法,称为setXSSAuditorEnabled".所以就我而言,我做了 view.preferences.XSSAuditorEnabled = false 使其工作.

So after some digging I found the solution. There's an undocumented, private method called 'setXSSAuditorEnabled' on WebPreferences. So in my case, I did view.preferences.XSSAuditorEnabled = false to make it work.

这篇关于在 Safari/WebView 中禁用 XSS 过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆