Wednesday 24 August 2011

Loading file urls in the native application via Notes

When working on our File Indexing/Searching product, we noticed that when using a Notes Client to open HTML links to a url starting file://, the target file would open in the Browser, if the Browser was able to recognise the extension. What we wanted was the file to open in it's native application.

For example, a link to file://c:/test.pdf would load test.pdf in the default Browser, and not in Acrobat, even if Acrobat was installed on the PC.

After a lot of messing about we found that a malformed url will not be passed to the Browser (like a legacy hotspot link), but instead left to Notes to handle, and Notes obliges by loading the file in it's native application. 

For example you can mess up the url so that Windows doesn't think it's valid, but it still works in Notes, by appending a space then period at the end.

So a url like "file://c:/test.pdf ." (with a space then period at the end) will open the file in the native application, without loading the browser, which is what we wanted.