Swift:WebKit View / WebView禁用JavaScript或Flash等插件

时间:2015-10-22 21:54:02

标签: swift webview webkit interface-builder

我正在使用WebKit View(在Mac OSX应用程序中)并希望禁用JavaScript或Flash等插件。我取消选中Interface Builder中的选项,但结果没有显着效果。我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

无法弄清楚为什么Interface Builder中的复选框没有效果,但是,这是以编程方式解决方案:

customWebKitView.preferences.plugInsEnabled = false
customWebKitView.preferences.loadsImagesAutomatically = false
customWebKitView.preferences.javaScriptEnabled = false