Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Safari preferences there is an option to disable Java which is nice but a bit cumbersome. Is there a plugin/addon/extension or an easy way to toggle Java on/off?

share|improve this question
Respectfully, it's ridiculous to say that a three step process is cumbersome. You want to go out to the internet, find a program, install it, activate the program, and flip a switch, to turn off Java instead of use a built in button combination, a point and click, and another point and click? No, there's no extension because the process can't be made simpler than it already is. – Everett Jan 24 '13 at 4:41
Thank you Everett for your insightful comment. – Henrik Söderlund Jan 24 '13 at 4:57
@Everett - I have to disagree. If you do a task often enough, even saving a couple of clicks can be worthwhile. I used to switch network locations a lot and ended up using quicksilver to simplify it, so I know exactly why Henrik is asking. – Chris Jan 24 '13 at 17:05
@Chris - Apparently I stand corrected. Also thank you for mentioning the Quicksilver thing. It works in LaunchBar too. You just made my life easier AND taught an old dog new tricks. That's pretty awesome. – Everett Jan 24 '13 at 19:00
@HenrikSöderlund - Thank you for your useful snark. Chris has an awesome answer. – Everett Jan 24 '13 at 19:02
up vote 3 down vote accepted

You could use applescript to toggle Java off/on. Save the script as an application and call it with a hotkey or from a link.

The following worked for me (YMMV):

        tell application "Safari"
        end tell  
        tell application "System Events"
                tell process "Safari"
                        click menu item "Preferences…" of menu "Safari" of menu bar item "Safari" of menu bar 1
                        click button "Security" of tool bar 1 of window 1
                        click checkbox "Enable Java" of group 1 of group 1 of window "Security"
                        click button 1 of window "Security"
                end tell
        end tell
end try

A link to the code:

share|improve this answer
Excellent, I thought there would be a solution! But hey, in the AppleScript editor, it tells me "expected end of line, but found class" and selects the word "checkbox" – Henrik Söderlund Jan 25 '13 at 1:39
Try it now. For some reason the formatting of the code is really screwy. There was a new line missing before the "click checkbox..." line – Chris Jan 25 '13 at 3:22
I pasted your great solution as an "extension" in Alfred Launcher App and assigned a hotkey through there too, now works beautifully with Control+Alt+Cmd+J. Many thanks! – Henrik Söderlund Jan 26 '13 at 13:51
@HenrikSöderlund - You're welcome; happy to help. – Chris Jan 27 '13 at 3:41

With Safari open, hit Command, (command and comma together). When Preferences opens select Security. Uncheck the third box down that says Enable Java.enter image description here

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .