Last active
August 20, 2022 13:57
-
-
Save jacobsalmela/ddb19c67791b8335e923 to your computer and use it in GitHub Desktop.
Adds URLs to Safari's exception list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
killall Safari > /dev/null | |
# Set your variable values here | |
bud='/usr/libexec/Plistbuddy' | |
plist='/Users/student/Library/Preferences/com.apple.Safari.plist' | |
urls=('https://www.testnav.com/mn/testnav-7.5.22.36/' | |
'https://proctorcaching.pearsonaccess.com/ems/systemCheck/systemCheck.jsp?acc=mn' | |
'https://testnav.com/mnqc/testnav-7.5.22.36/epatLogin.jsp?testnavTestId=TRG10R14&testnavFormId=S01M4' | |
'https://testnav.com/mnqc/') | |
# Remove plist to start fresh | |
#echo "Removing Safari .plist..." | |
#rm -f "$plist" | |
killall cfprefsd > /dev/null | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" ${plist} | |
for i in "${!urls[@]}" | |
do | |
domain=$(echo ${urls[$i]} | cut -d'/' -f3) | |
#echo "Setting to run in unsafe mode: ${urls[$i]}..." | |
echo "Setting to run in unsafe mode: $domain..." | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:$i dict" ${plist} | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:$i:PlugInPageURL string ${urls[$i]}" ${plist} | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:$i:PlugInHostname string $domain" ${plist} | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:$i:PlugInRunUnsandboxed bool YES" ${plist} | |
${bud} -c "Add :ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:$i:PlugInPolicy string PlugInPolicyAllowWithSecurityRestrictions" ${plist} | |
done | |
killall cfprefsd | |
defaults read com.apple.Safari > /dev/null | |
# Enable pop-ups | |
echo "Enabling pop-ups..." | |
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jacob,
We use the below to allow plugins to run via Safari.. it's cleaner as no cfprefsd killing as the processes are aware of cpfrefsd
Might be something to try?