MacOS – Automatically close Chrome tabs (for certain websites)

automatorgoogle-chromemacos

On our family mac, each child has a separate account, which is very nice.

The kids use Chrome for their browser, because the parental controls work so well (much better than the OS X built-in ones!), but the parental control mode doesn't allow extensions, and some of the websites they leave open (ChoreMonster, Mathletics) really peg the CPU. If these sites are left open (on the kids' users) then when my wife or I try to log in to our user, our brand new mac is unbearably slow.

Is there an OS X-based way to shut down tabs for certain sites whenever it switches away from that user, or when the browser is idle for a long time? A way that doesn't require a Chrome extension?

Automator, perhaps?

Best Answer

There's a Macworld article that may help you do what you want, although it focuses on logging out idle users in a fast-switching environment rather than closing applications. That said, if you have a launch agent monitoring the idle state of the user, it should be possible to have it trigger an AppleScript that brings Safari into focus and tells it to exit.

It might be easier to just have their accounts logged out when they're idle.