views:

63

answers:

1

I have a local web app that lets users attach and view files. Viewing files is simply window.open(fileName), however whenever the filename has a # sign in it the file will fail to open with a dns error. I've tried escaping the # symbol with %23, and \# but it still fails to open... is there something special I need to do to escape the # symbol in a window.open url?

I've copied the filepath from the source file directly to a web browser and it opens fine, so I was assuming it was an issue with the window.open command.

EDIT: window.open code as requested. The url is always something local on our network such as \\path\fileName.pdf

window.open('file:' + url, '', 'top=10,left=10,height=' + (screen.height - 50) + ',width=' + (screen.width - 50) + ',titlebar=no,resizable=yes,scrollbars=1');

EDIT #2: I tried escaping the # right before the window.open string with %23 and displayed it with a prompt right before window.open, and I can copy/paste the string to IE and it opens fine, however the window.open code still fails.

URL Path: file:\\NetworkPath\Doc #1.pdf

Value window.open is giving me: res://ieframe.dll/dnserror.htm#file://NetworkPath/Doc

The app is hosted in an embedded web browser within our software application which uses IE (I think 6)

+1  A: 

Looks like there was a bug listed in Microsoft's kb way back with IE6. :)

epascarello
Thank you, that is probably my problem. The embedded web browser this software uses is IE6 and I don't think I can update it. I ended up modifying the FileUpload process to remove any # symbols from filenames prior to saving, and for existing files I'm just throwing up a prompt containing the URL so they can copy/paste it into a web browser on their own. The app only has a handful of users and they're the sort that can handle basic instructions like that :)
Rachel