允许通过终端Mac在Safari中通过Apple Events中的JavaScript [英] Allow JavaScript from Apple Events in Safari through Terminal Mac
问题描述
我正在编写一个在Safari中执行do javascript
的程序.唯一的问题是,我正在尝试使该应用程序具有自我许可的权限.我正在尝试查找处理Safari开发人员首选项的文件,以便可以执行此操作.有谁知道这可能在哪里或如何更改这些设置?
I'm writing a program that executes do javascript
in Safari. The only problem is that I'm trying to make the app give its self permission to do it. I'm trying to locate the file that handles the Safari developer preferences so that I can do this. Does anyone have any idea where this might be or how to change these settings?
推荐答案
它在Safari的首选项plist中,位于~/Library/Preferences/com.apple.Safari.plist
.您想要的密钥是AllowJavaScriptFromAppleEvents
.您可以使用defaults
设置它:
It's in Safari's preferences plist at ~/Library/Preferences/com.apple.Safari.plist
. The key you want is AllowJavaScriptFromAppleEvents
. You can set it using defaults
:
#to turn it on
defaults write -app Safari AllowJavaScriptFromAppleEvents 1
#to turn it off
defaults write -app Safari AllowJavaScriptFromAppleEvents 0
这篇关于允许通过终端Mac在Safari中通过Apple Events中的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!