It's not a virus. It's a malicious web page created by imbeciles who are trying to find and rip off the few people on earth even more stupid than themselves — a difficult task.
Some of those scam threat pages can be dismissed very easily. Press
command-W to close the tab or window. A huge box will pop up with more illiterate, childish threats. Press the
return key and both the box and the page will close. If that doesn't happen, continue.
From the Safari menu bar, select
Safari ▹ Preferences... ▹ Security
and uncheck the box marked
Enable JavaScript. Leave the preferences dialog open.
Close the malicious window or tab.
Re-enable JavaScript and close the preferences dialog.
If the
Preferences menu item is grayed out, quit Safari.
Force quit if necessary. Relaunch it by holding down the
shift key and clicking its icon in the Dock. From the menu bar, select
Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
to get rid of any cookies or other data left by the server. Open your Downloads folder and delete anything you don't recognize.