Problems with HTML links in Internet Explorer 8

倾然丶 夕夏残阳落幕 提交于 2020-01-17 03:24:05

问题


I'm having some problems supporting Internet Explorer 8 in my application.

When a user clicks on a link in non-IE8 browsers, the link works fine and goes to the correct position on the page. Using Internet Explorer 8, however, the links only work when the it doesn't take all of the screen.

To better describe the problem, I took the following screenshots:

DOESN'T WORK

WORKS

Links on the first page appear as such:

<a href="http://domain/sede/ver/4143?tec=fibra#fibra1537"></a>

The IDs for links appear as such:

<a id="fibra1537"></a>

What is happening?


回答1:


I would try to use the name attribute in addition to the id attribute.

<a id="fibra1537" name="fibra1537"></a>

EDIT: @greg explains why here

For HTML documents (and the text/html MIME type), the following processing model must be followed to determine what the indicated part of the document is.

  1. Parse the URL, and let fragid be the <fragment> component of the URL.
  2. If fragid is the empty string, then the indicated part of the document is the top of the document.
  3. If there is an element in the DOM that has an ID exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.
  4. If there is an a element in the DOM that has a name attribute whose value is exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.
  5. Otherwise, there is no indicated part of the document.


来源:https://stackoverflow.com/questions/16282878/problems-with-html-links-in-internet-explorer-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!