在 Safari/WebView 中禁用 XSS 过滤器 [英] Disable XSS filter in Safari/WebView
问题描述
我正在开发一个用于 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屋!