Latest in Applescript

Image credit:

Kill no-close-em Safari pages with AppleScript

Erica Sadun, @ericasadun
September 3, 2014
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

Jabra's ANC update for the Elite 75t earbuds is now available

Jabra's ANC update for the Elite 75t earbuds is now available

View
California Uber drivers sue company over Prop 22 app notifications

California Uber drivers sue company over Prop 22 app notifications

View
'Uncharted' set photos offer our first look at Tom Holland as Nathan Drake

'Uncharted' set photos offer our first look at Tom Holland as Nathan Drake

View
The Apple TV app is coming to PS4 and PS5

The Apple TV app is coming to PS4 and PS5

View
NASA shares first images from OSIRIS-REx's touchdown on Bennu

NASA shares first images from OSIRIS-REx's touchdown on Bennu

View

From around the web

Page 1Page 1ear iconeye iconFill 23text filevr