Extensions for Safari available for Windows and Mac OS X versions
Safari team has published a new API for extensions development. Extensions are officially available since Safari 5.0, through a JavaScript API that really looks like Chrome API. Some new features (essencially events) have been added, and that’s makes this API more interesting ! Indeed, now you can catch events related to website loading, and in my case, that was what was missing.
Unfortunatly, you can’t do more than 10% of what you could do with old extensions system… talk about system, it’s more a hack that redefines Safari functions, a lot of reverse engeneering to do for an extension that might not work after a Safari update.
Features overview
Main features are present :
- Add a toolbar button (not in color, only B&W…) ;
- Execute injected script into webpages ;
- Build customized menus (sticking to this format : icon, text, action/submenu) ;
- Display an HTML toolbar (only 32px height, impossible to insert menus, but it’s better than nothing !).
Javascript API Autocompletion
When you use such external API, it’s very hard to have a completion when you write your code using IDE that support this feature, like Eclipse.
Thus, I generated a small JS File that describes the global safari object, using JSDoc.
Click here to download JS File (v5.1), then add it to your editor.
More info on Safari Extensions
You will find more informations on Safari Extensions Website, on apple developer site, with mainly two documents :