Question

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)

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top