Safari’s hidden debug menu

Trouble debugging your Javascript in Safari? Me too! That’s why I found this little tip useful (notice I say ‘useful’ and not ‘very useful’).

Safari is usually a very large pain when building Javascript apps. There are many small issues that seem to pop up all the time. But now with the release of Safari 2.0, you have a bit of help. Safari now has a Javascript console! It’s nothing fancy, and the errors it shows are sometimes less than optimal, but it’s far better than just guessing randomly at the problem.

To enable the Javascript console, first you must enable Safari’s debug menu. Do this by opening your Terminal and inputting this line:

defaults write com.apple.Safari IncludeDebugMenu 1

Now the next time you start Safari, you’ll have an extra menu up top called “Debug” and inside are all kinds of goodies. Here’s what the menu looks like:

Safari debug menu

Back to the original point of this post, one of the items is “Show JavaScript Console” and selecting that item opens up this little window:

Safari Javascript Console

It’s not nearly as sleek and useful as the Firefox/Mozilla Javascript console, but it’s a step in the right direction, and definitely better than nothing.

FlashObject 1.2

I’m pleased to announce version 1.2 of my FlashObject script. The big new addition is minor version detection and revision detection, so now you can detect versions like "6.0.65" if you like. I also got some advice from Toby Boudreaux, who provided tons of help in getting the code all fancied up and name spaced, so it shouldn’t collide with any other scripts on your websites now. We also went through and leaned out some features that weren’t being used much. Namely the fo.altTxt var and the extra line that included the bypass detection link. You can still bypass the detection just as you have been, but the script will no longer automatically write the alternate content at all (even if you manually override it like you could in v.1.1). If you have no idea what that last sentance means, just ignore it, as you probably weren’t using the feature anyway.

I’ve also given FlashObject a permanent home at http://blog.deconcept.com/flashobject/.

Here’s the full list of what has changed:

  • fo.write() now requires an element ID. In previous versions you could call write() with no parameters and the FlashObject script would write the Flash movie to the page wherever the script was placed on the page. This is no longer the case and now you must specify an element ID.
  • fo.altTxt no longer exists. You must now place all your alternate content or upgrade message in the div where your Flash content will be written.
  • fo.redirect no longer exists. When using FlashObject to redirect users to a separate upgrade page, you now specify the redirect url like this: fo.setAttribute('redirectUrl', 'http://www.example.com');

I highly recommend upgrading to this version. While I was adding the minor version detection, I found a bug that will cause Netscape plugin based browsers to fail the Flash detection once the major version gets up to two digits. That means it will work fine up to Flash 9, but then return 0 if the user has Flash player 10 (this is all assuming Macromedia keeps incrementing the version numbers, and that Adobe doesn’t change everything around when they take over).

So that’s it. This will probably be the last version update to FlashObject, since there isn’t much else I could add that would be useful to everyone. So go tell your friends about it – there’s really no reason you shouldn’t be using this to embed your Flash movies.

UPDATE: Dave Benjamin pointed out a flaw in the new detection checking function, and that has been fixed. I also fixed a very small issue with the version check that would cause it to fail if you had version 9.1.0, and the page required 8.2.0 (for example), so make sure you get the latest version.

UPDATE (07-27-2005): Matthew Richmond set me up with a better looking test file, that also shows the full page version much better, so the download / example pages have been updated.

UPDATE (08-01-2005): Just fixed a bug in the detection function that would throw an error when no Flash player was installed, thus casing the redirect to fail if you were trying to redirect users to an upgrade page. Thanks to Carl Wurtz for pointing that out. I also took the chance to update the ActiveX plugin detection code. No more VBscript in there (not even an execscript() call). New version number is 1.2.2 – make sure you have the latest version!

After Flash Forward

We just finished up our Flash Forward session. If you were watching I would love to hear feedback (just leave a comment or send me an e-mail).

Here are links to the projects we showed or talked about:

And if you couldn’t make it, Brandie posted some pictures.

UPDATE: Here’s the presentation in PDF format. (44MB)