空的HTML href导致在IE中的目录列表 [英] Empty HTML href leads to directory listing in IE

查看:149
本文介绍了空的HTML href导致在IE中的目录列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有单独HTML文件的网站(实际上是.shtml,但这对于这个问题并不重要)。这些shtml文件包含一个图片,一个前进和后退按钮,这样我就可以切换回预览shtml文件或浏览下一个,就像在一个图库中一样。所有这些shtml文件都是在本地生成的。我用Java编写了一些生成器。基本上这是有效的,第一个shtml文件和最后一个指向< a href =....> 。当用户点击它时,没有任何反应。这是预期的行为。它在FF,Chrome,Opera中测试过,它在那里工作,但不在IE中。当我在IE中点击或下一步时,我会看到目录列表。这是一个IE问题还是只是一个配置问题?可能我必须更改生成器代码,但如果我不需要,我不想。那么有没有另一种解决方案呢? 解决方案

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


如果将HREF指定为空白值(href =或href =),则执行链接可能会显示包含当前文档的目录,或者它可能会生成一个错误,具体取决于文档和服务器环境中的其他元素。

这种行为是有目的的,没有解决办法。你必须想出一些不使用空白href值的东西,比如 href =#


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?

解决方案

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="#"

这篇关于空的HTML href导致在IE中的目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆