Kill no-close-em Safari pages with AppleScript
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.
Subscribe to Newsletter
Software Updatesmore updates
- Vizzywig 8xHD price tag now a very affordable $49.99
- Automatic targets teen drivers with License+ service
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)
- NFL Mobile updated for 2014 Season with new Fantasy Football features, NFL Now integration