Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
@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

2 Answers 2

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):

try
        tell application "Safari"
                activate
        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

Edit:
A link to the code:
http://pastie.org/private/ea7qbuareh6uje8zsglcia

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.