Latest in Applescript

Image credit:

Kill no-close-em Safari pages with AppleScript

Share
Tweet
Share
Save

Sponsored Links

I hate those pop-ups that hijack Safari even when I've enabled Settings > Security > Block Pop-up windows. Sure, I've edited my hosts file with Someonewhocare's updates to avoid them in the first place but even so, bad pages still happen.

With a simple web search, you'll find a variety of conventional solutions for these situations. I prefer to close them automatically without interacting with pop-ups directly or force-quitting Safari. Here's where a simple AppleScript application can help.

I use AppleScript to tell Safari to "close window 1", i.e. the frontmost window. This dismisses the problematic window on my behalf. I have this script saved to an application (File > Export > File Format > Application) and have docked it for easy access. When bad windows open, my solution is just a click away.

Got another fix or an improvement to this one? Drop a note in the comments and share.

In this article: AppleScript, how-to, howto, Safari, tips, tricks
All products recommended by Engadget are selected by our editorial team, independent of our parent company. Some of our stories include affiliate links. If you buy something through one of these links, we may earn an affiliate commission.
Comment
Comments
Share
Tweet
Share
Save

Popular on Engadget

'Rainbow Six: Siege' adds a 'Fortnite' style Battle Pass

'Rainbow Six: Siege' adds a 'Fortnite' style Battle Pass

View
Three UK rolls out 5G home internet access in London

Three UK rolls out 5G home internet access in London

View
Sonos' portable smart speaker leaks in greater detail

Sonos' portable smart speaker leaks in greater detail

View
Kevin Smith is making a 'He-Man' anime series for Netflix

Kevin Smith is making a 'He-Man' anime series for Netflix

View
SpaceX Starman Roadster completes its first orbit around the Sun

SpaceX Starman Roadster completes its first orbit around the Sun

View

From around the web

Page 1Page 1ear iconeye iconFill 23text filevr