空 HTML href 会导致 IE 中列出目录
我有一个带有单独 HTML 文件的网站(实际上是 .shtml,但这对于这个问题来说并不重要)。这些 shtml 文件包含一张图片以及一个前进和后退按钮,因此我可以切换回预览 shtml 文件或浏览到下一个文件,就像在画廊中一样。所有这些 shtml 文件都是本地生成的。我用 Java 编写了某种生成器。基本上这是有效的,第一个 shtml 文件和最后一个指向 。当用户点击它时,什么也没有发生。这是预期的行为。它在 FF、Chrome、Opera 中进行了测试,并且可以在其中运行,但不能在 IE 中运行。当我在 IE 中单击“后退”或“下一步”时,我会看到目录列表。这是 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 http://msdn.microsoft.com/en-us/library /cc848861%28v=vs.85%29.aspx
此行为是设计使然,没有解决办法。您必须想出一些不使用空白 href 值的内容,例如
href="#"
From http://msdn.microsoft.com/en-us/library/cc848861%28v=vs.85%29.aspx
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="#"
将其更改为
或
Change it to
<a href="#">
or<a href="javascript:;">