I'm a developer supporting Safari 8 and 9 and would like to be able to run both on the same machine. I assume Safari 9 won't run on Yosemite. Is there a way to install Safari 8 on El Capitan?
I'm a web developer as well with a need to test on older versions of Safari. Here's your best bet (caveat: this assumes you own VMware Fusion or a similar virtual machine emulator that can handle Mac OS).
Assuming you've upgraded your Mac through previous versions of Mac OS (Yosemite, El Capitan, etc), you can still access those in the AppStore under "Purchased." Find the OS you want and click the "Download" button.
Once it's done, check your /Applications folder for "Install El Capitan" (I forget the exact filename, but it begins with "Install"). With VMware Fusion, it's insanely easy to install this as a virtual machine. Open up Fusion and add a new machine, and choose "Install from disc or image" and simply drag/drop the Mac OS installer app onto the VMware import window.
Follow the usual steps to install a virtual machine, make sure you allocate enough RAM, and you're good to go! By doing this, I was able to install El Capitan as a virtual OS on my Sierra machine, and test on Safari 9.
While you can't install previous versions of Safari, you can emulate previous versions. From the Develop menu, select User Agent, and then Other....
From there, you can enter in a custom User Agent. For example, from the link in Tetsujin's above answer, you can replace the Safari agent thus:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12
You should be able to emulate any prior version of Safari in this manner.