Drupalist

MIDI

Flexibly titled pop-up windows

Here's a tip to add to the previous articles here about pop-up windows. When you invoke a pop-up with Javascript, the window is automatically given a title which is the URL of the page it is viewing. But often one wants a simpler title like, say, "Play audio", instead of the URL of the audio file. What to do?

An easy solution I found was to put the file within its own Javascript IFrame(). That way, the invisible title of the IFrame is the file URL, while the window can have whatever title one sets.

Robust popup links in Drupal 6

Once MIDI files were reliably playing in the browser (see the previous post), the next thing I wanted was to have them play in little popup windows, instead of making a blank new page and playing there. Having to hit the browser's "Back button" after playing any MIDI was not acceptable.

The first way I did this was to put the Javascript code to make the popup window inside the link (with an onclick attribute). The problem with that method is that the link is completely broken when Javascript is not supported. Clearly a new page to play the file is the best option when Javascript is not supported.

So, the question is, how can one get a popup when Javascript is supported, but have the link still go to a new page and load the file when it is not?

MIDI links playing in the browser

Getting MIDI links at Composers' Village to play in people's browsers has been an interesting challenge. After I first noticed that the links were prompting file downloads, investigation led me to the "Content-Disposition" header that FileField puts on files downloaded from a filefield. (FileField is the name of the Drupal module that I am using to implement the file links for the Village, and the particular container is a filefield.)

Drupal SEO