Skip to main content

Anyone know how to programmatically enable a browser plugin? Our VPN solution requires the Java plugin to be active and upon first launch it's disabled. Due to general Safari behavior, enabling the plugin and restarting Safari can become a less than optimal experience. If the Java plugin were enabled to begin with, it would be great.



Thanks

Hi,



Refer to the below Rich link for enabling JAVA at login. (Thanks Rich)



https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/enable_java_web_plugins_at_login



Regards,
Karthikeyan


Sa-weet.



Thanks. (Rich esp)


i run this as a launch agent.



#!/usr/bin/perl -w



# config runtime environment
use strict;
use Getopt::Std;
use Sys::Syslog;
use Env qw(HOME);



my $MAC_UUID =system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}';
chomp($MAC_UUID);
my $byhostdir = $HOME . "/Library/Preferences/ByHost/";
my $date = time - 978307200;
my $javapref = $byhostdir . "com.apple.java.JavaPreferences.$MAC_UUID.plist";
my $plistcmd = "/usr/libexec/PlistBuddy";



(my $progname =$0) =~ s#.*/##;
$ENV{PATH} = '/bin:/usr/bin:/usr/sbin';
umask 0022;



main:
openlog $progname, undef, 'user';
system("mkdir -p $byhostdir") unless (-d $byhostdir);
# Activates the "Enable applet plug-in and Web Start Applications" setting in Java Preferences
syslog('notice', "ensuring Java WebPlugin is enabled.");
system("$plistcmd -c "Add :GeneralByTask:Any:PrefsVersion string 2" $javapref");
system("$plistcmd -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" $javapref");
system("$plistcmd -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $date" $javapref");
syslog('notice', "startup script complete");
closelog;
exit 0;