How to know when you web browser is about to download a file
Background: Search Engine Optimisation (SEO) is a term used to describe a variety of techniques that are used to boost the ranking of web pages in the results listing of search engines. These techniques are being abused by spammers and scammers to increase their own SEO web pages so that they appear high up in any search result. The resultant web page is used to display malicious content and automatically download and run malware on the user's computer.

This approach has been augmented by the scammers running JavaScript within the user's browser to give the impression that a virus scan is occurring, which reports numerous viruses, trojans and spyware on the user's Mac. The purpose of these attacks is to scare the user into purchasing fake antivirus software. For example,
OSX.MacDefender

safari40
Safari
To prevent trojans such as MacDefender from being automatically downloaded and unpacked by Safari disable the ‘Open “safe”files after downloading’ option in the General Safari preferences. Note: this will affect all downloads not just trojans!

Safari_prefs

chrome40
Chrome
To be notified whenever Chrome downloads a file, automatically or manually, select Preferences from the Chrome menu and click the Show advanced settings… link at the bottom of the page. Next, enable the Ask where to save each file before downloading checkbox.

Chrome
firefox40
FireFox
Select Preferences from the FireFox menu. Ensure the General tab is selected and enable the Always ask me where to save files option.

FireFox