Skip to content

Blog

Toggle JavaScript and Plugins in Safari

I don’t like to browse the web with JavaScript and Flash and so-on automatically enabled unless I think I need it. A large percentage of ‘web annoyances’ can be avoided simply by turning off JavaScript and plugins unless you really need them. There’s also a security argument to doing this too.

In Firefox, I use NoScript to do this and it works really well. I’ve been using Safari more and more frequently in recent times, however, and I am not aware of a similar solution for the Mac’s default browser.

So I have devised a couple of AppleScripts, which were heavily inspired by and partially derived from the example on this Mac OS X Hints page. They allow me to toggle on and off JavaScript and plugins, respectively (I never have big Java switched on at any time!)

Please note that this is for Safari for Mac OS X only and is designed specifically for the new Snow Leopard Services functionality.

I have created them as Automator Services. The benefit of making them Services is that you can then assign a keyboard shortcut directly to the script and be able to simply press that keyboard shortcut to quickly invoke the script and do the toggle. It’s a lot quicker than hunting through a script menu or launching an application and doesn’t require any third-party software.

System Preferences Keyboard Shortcuts

If you’d like to use these Services, download them below. Once unpacked, drop the files in ~/Library/Services, go to System Preferences > Keyboard > Keyboard Shortcuts, select Services from the list and assign your desired shortcut to the two scripts.

These scripts use Growl to notify you of the toggled state after the script has run. You’ll need Growl installed to make full use of it.

Download the Toggle JavaScript and Plugins scripts (zip archive, 270 KB)

Come on, Apple!

So I’m downloading the WebKit source code which I need for an upcoming FOSSwire tutorial. Downloading it from SVN is painfully slow, but then I can’t remember SVN checkouts ever having been that fast.

There’s another option to download – grabbing a .tar.bz2 of the latest nightly. Downloading that over HTTP is, guess what, also painfully slow.

Downloading WebKit progress

The top speed this connection can do on download is around 250 Kbytes per second. It’s downloading at less than 10% of that capacity, with no other activity on the connection. Downloads from other sites run much faster. Now it might just be me, but I can’t help thinking Apple are either not putting enough resources into WebKit.org, or they’re deliberately degrading the download experience.

I hope for their sake it’s the former, and if so, come on Apple, put some resources into it! You wouldn’t have a base for Safari if it wasn’t for the open source community, so let’s be nice back shall we?