Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty HTML href leads to directory listing in IE

I have a website with separate HTML files (actually .shtml, but this is unimportant for this issue). These shtml files contain a picture, and a forward- and backbutton so I can switch back to the preview shtml file or browse to the next one, like in a gallery. All these shtml files are generated locally. I wrote some kind of generator in Java. Basically this works, the first shtml file and the last points to <a href=""....>. When the users clicks on it, nothing happens. This is the expected behaviour. It was tested in FF, Chrome, Opera and it works there, but not in IE. When I click back or next in IE, I get the directory listing. Is this an IE problem or just a configuration issue? Probably I have to change the generator code but I don't want to if I don't have to. So is there another solution for that?

like image 473
Bevor Avatar asked Nov 01 '11 12:11

Bevor


1 Answers

From http://msdn.microsoft.com/en-us/library/cc848861%28v=vs.85%29.aspx

If HREF is specified as a blank value ( href="" or href=), executing the link might display the directory containing the current document , or it might generate an error, depending on other elements in the document and the server environment.

This behaviour is by design and there is no work around. You'll have to come up with something that doesn't use a blank href value, such as href="#"

like image 163
Alain Avatar answered Sep 20 '22 00:09

Alain