Hello and Welcome to Sugar Mountain!

....a place of random thoughts

Working with Safari Extensions

Filed Under (Coding, Javascript, Safari) by Olle on 20-08-2010

So I have had my first go with a Safari Extension and it has not been a smooth ride I tell you! The documentation over at Apple really leaves one wishing for more.

Some of the questions that I have manage to fix without documentation are the following

“How the heck do I add icons to the Safari Settings page?

Unless you want to have the default Safari Extension icons in Safari Settings(after installation), in the Safari Extension Builder and in the Installation Dialog, make sure you add three icons to your extension folder and call them:

And I guess you can figure out the dimensions of the icons, yes it 32×32, 48×48 and 68×68.
The result will be this:

Why the heck does not the updates work?

I made a lot of  misstakes when it comes to the update part of the Extension.
I finally got it to work by leaving the default value when it comes to “Bundle Identifier “.

When you create your new Extension you choose a name, for example myex.ver1, and the builder will create the folder(myex.ver1.safariextension with the Info.plist) for you and also create the default “Bundle Indentifier” in the Extension Builder. In my example the Identifier will be com.yourcompany.myexver1.

Now make sure that you only change the “com.yourcompany” part of the Identifier. I made the mistake of modifying the last part as well. In my example my Identifier looked like this “net.subelement.myex.ver1“.

The problem with this is that the updates will not ever work, when you have a .plist that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
   <key>Extension Updates</key>
       <key>Developer Identifier</key>
       <string>YOUR IDENTIFIER</string>

So the thing is to always user the suggested Identifier, or you might end up in the same problems as I did.

Leave a Reply