Latest in Applescript

Image credit:

Kill no-close-em Safari pages with AppleScript

Share
Tweet
Share

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

Popular on Engadget

Master & Dynamic's MW07 Plus are much-improved true wireless earbuds

Master & Dynamic's MW07 Plus are much-improved true wireless earbuds

View
Master & Dynamic's MW07 Go is a $199 AirPod alternative

Master & Dynamic's MW07 Go is a $199 AirPod alternative

View
California's statewide earthquake alert system launches Thursday

California's statewide earthquake alert system launches Thursday

View
Skydio's station lets self-flying drones work around the clock

Skydio's station lets self-flying drones work around the clock

View
‘Harry Potter: Wizards Unite’ gathered location data while users slept

‘Harry Potter: Wizards Unite’ gathered location data while users slept

View

From around the web

Page 1Page 1ear iconeye iconFill 23text filevr