Safari is by far the most efficient browser for OS X. It is so efficient, it even suspends tabs you don’t look at. While this probably saves a lot of energy and CPU usage, it also causes a few problems.
For example, if you use Facebook or messenger.com in your browser, you rely on the notification sound. When the tab is active, everything works well. If it’s inactive, you won’t get any notification sound, not until you open the tab.
Unfortunately it is not possible to deactivate App Nap specifically for Safari. You have to disable it system-wide:
defaults write NSGlobalDomain NSAppSleepDisabled -bool YES