I've been debugging a curious issue with file paths in an instance of IE embedded in my application.
I have the following JavaScript/jQuery:
<script type="text/javascript">
function foobar(src) {
$("img").attr("src", src);
}
</script>
And my DOM contains a single img
tag:
<img src="loading.jpg" />
I have the following three links which call foobar
when activated:
<a href="javascript:foobar('file:///C:/nospaces/someimage.bmp');">without spaces</a>
<a href="javascript:foobar('file:///C:/path spaces/someotherimage.bmp');">with spaces</a>
<a href="javascript:foobar('file:///C:/path%20spaces/someotherimage.bmp');">with spaces</a>
All of those links work great in IE/FF/Chrome, but only the first link works in my application where I'm using an embedded instance of IE.
If I right-click the image after clicking the second link (one of the two that doesn't work, the third one gives the exact same results), I can see the image URL is this:
file://C:\path%20spaces\someotherimage.bmp
which doesn't load if I paste that address into Start->Run.
Changing the address to add a third /
after file:
, like this:
file:///C:\path%20spaces\someotherimage.bmp
allows Start->Run to open the image.
Interestingly, non-embedded IE retains all 3 slashes (file:///
), so all three links work.
Has anyone come across this sort of issue? Any ideas how to fix it?