Q. I sometimes get obviously fake virus alerts invading my desktop browser, but the only option to make the box go away is to click the O.K. button — which I am afraid to do. Where do these things come from, and is there an easier way to get out of this besides shutting down the whole computer?

A. Fraudulent virus messages have been popping up in browsers and other parts of operating systems for years, and Windows users are not the only people getting them. The false alerts can be triggered by clicking on a malicious link, mistyping a web address that leads to a scammer’s site, landing on a page running malevolent scripts (or hosting poisoned advertisements) and other actions.

These types of browser-based “virus” alerts are scams.

Even if a scareware alert pops up, you can dismiss it without rebooting your whole computer — just forcibly quit the browser program. On a Windows PC, hold down the Control, Alt and Delete keys to open the Task Manager app, select the browser from the list of running programs and click End Task. On a Mac, press the Option, Command and Escape keys, select the browser in the list of programs and click the Force Quit button.

If your browser is set to remember open tabs when it closes, decline the offer to open them again when the program starts. If the pop-up returns right away, going into the browser’s settings and clearing the recent history and cache may flush out lingering traces of the fake alert; resetting the browser to restore it to its original vanilla state is a further step.

Maintaining a real, regularly updated security program on your computer can keep general malicious code at bay. Malwarebytes Anti-Malware, Avastand AVG are among the companies that offer free basic security software for Windows and Mac systems, with the option to move to a more full-featured suite for a fee.