Thursday, May 21, 2009

Lynx Text Browser - Downloading Document Error

I was developing an Accessible web site the other day which included downloading of documents (either Word, Excel or PDF). It just contains an anchor tag for the document which will open the document in Acrobat Reader allowing the user to "Save As". It worked as designed in Internet Explorer and FireFox but gave an error when I tried it in the Lynx Text Browser. The error message was:

The exception Integer division by zero.
(0xc0000094) occurred in the application at location 0x00451c24.

There is not a lot of technical help around Lynx and Google didn't offer any meaningful results. But I found that I could download a text file in Lynx without problem so I figured it must be something to do with the inability to recognise the PDF file type.

After some more research I found an obscure attribute for the Anchor tag in HTML. This is the "type" attribute in which you can add the content type. So to the Anchor tag for the document I added

type="application/pdf"

and that did the trick. It appears that Lynx requires this extra hint of the file type to avoid the error shown above. I also added the type attribute for the other file types for good measure and it all works fine now.

No comments: