Enter the following into a Terminal/X11 window:

defaults write com.apple.safari IncludeDebugMenu 1

This enables access to the Debug menu that includes options for changing the User Agent, Enforce strict Certificate checking, disable certain protocols, Mouse/Keyboard shortcuts page, JavaScript console, etc.