This is exactly why I have a keyboard for Safari to disable JavaScript and that feature is one reason why I prefer Safari.
It is also handy on sites which try to block the 'copy' command or otherwise abuse JavaScript.
I can enable/disable JavaScript just by pressing ⌘ + J
The GUI way
- Launch Safari
- Go to Preferences
- Go to 'Advanced' preferences
- Click 'Show develop menu in menu bar.
- launch System Preferences
- go to Keyboard preferences
- select 'Keyboard Shortcuts'
- choose 'Application Shortcuts'
- click the + button
- set Application to 'Safari'
- set the Menu Title to 'Disable JavaScript' (note that Capitalization is important, it must be exactly the way it is shown in Safari)
- set the keyboard shortcut to something like ⌘ + J
The Command Line Way
If 12 steps seems like a lot of hassle, try these two (Note: Safari must not be running when you make these change)
defaults write com.apple.safari IncludeDevelopMenu 1
(That is the equivalent of the first 4 GUI actions.)
defaults write com.apple.safari NSUserKeyEquivalents -dict-add "Disable JavaScript" '@J'
(This is the equivalent of the last 8 GUI actions.)
Note that the '@J' on the command line is equivalent to ⌘ + J. See http://www.mactipper.com/2008/02/add-keyboard-shortcuts-from-command.html for more information on adding keyboard shortcuts via Terminal.app.