Skip to main content
Answer

Programmatically enable browser plugin

  • September 12, 2012
  • 3 replies
  • 6 views

Forum|alt.badge.img+24

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

Best answer by karthikeyan_mac

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

3 replies

karthikeyan_mac
Forum|alt.badge.img+18
  • Honored Contributor
  • Answer
  • September 12, 2012

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


Forum|alt.badge.img+24
  • Author
  • Valued Contributor
  • September 12, 2012

Sa-weet.

Thanks. (Rich esp)


Forum|alt.badge.img+18
  • Valued Contributor
  • September 12, 2012

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;