Friday, December 16, 2011

More fun with webapps: Linking to files from Internet Explorer

I'm on a nerdy roll. Let's keep it that way.
So today at work I came across a fascinating (let's just call it fascinating and leave it at that) problem with (obviously) Internet Explorer. We've got a system that links the user to Excel-files, which has always worked fine. Something we did recently caused this to stop working with IE, although it kept working fine in other browsers. Of course, there was no logical error message either, the user was told that the file could not be found or something along those lines.
I googled this error message, because that's what you do. All I got was fixes for files served over SSL, which was not the case here. But it is apparent that serving binary files to users over SSL (yet again, in Internet Explorer) is another world of pain.
That pain is not my story though. Mine is how I couldn't find any indication of what MY problem was. This meant I was forced to actually think for once.
I won't go into details about my train of thought, but I ended up trying different methods of linking. The initial (and problematic) version opened the link using window.open(url) - the alternative is to rather just redirect the current window to the target page with window.href(url). This worked fine. Testing a bit further back and forth (and reading up on the subject), I came to the conclusion that Internet Explorer disallows access to binary files linked via a new window. This is apparently a security measure. I can't for the life of me figure out the reasoning behind this. It could've been popup-related, but html documents are accepted. Only binaries are blocked. So why block binaries via popups when they can be redirected to directly?

No comments: