IE 6 Local html link broken .NET webbrowser

若如初见. 提交于 2019-12-11 17:52:31

问题


I have a WebBrowser embedded in my application. I am loading an html document that has links to other sections in the document. Here is an example of how the link is created...

...
<span style='color:blue;mso-no-proof:yes'>
  <a href="#_Toc179681722">21-20-1 Distribution Damper
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>
        <span style='mso-tab-count:1 dotted'> </span>
     </span>
     <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>
        <span style='mso-element:field-begin'></span>
     </span>
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'> PAGEREF _Toc179681722 \h </span>
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>
        <span style='mso-element:field-separator'></span>
     </span><![endif]-->
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>21.1</span>
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>
        <!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003100370039003600380031003700320032000000</w:data>
        </xml><![endif]-->
     </span><!--[if supportFields]>
     <span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none;text-underline:none'>
        <span style='mso-element:field-end'></span>
     </span><![endif]-->
  </a>
</span>
...

When I am using my development machine (which has IE 8) and the document is loaded all the links work correctly.

When I load the document on the production machine (which has IE 6) and I click on a link it displays a new page with the text "blank#_Toc179681722" and nothing else.

Note: I might add that this html doc is created from Microsoft Word and I don't have much control over changing the syntax.

Anyone have ideas as to what is happening? And how to fix it?


回答1:


I am not seeing a closing tag </a> for your link.

A lot of newer browsers will fix this for you, and reinterpret the html. Its possible that IE6 is failing to do this, causing the url to function oddly.




回答2:


Can you set "_Toc179681722" as the id of the span that you want your a element to target?

Displaying a new page is definitely unusual, since a non-found tag is supposed to simply redirect you to the top of the page with no error. (Reference)



来源:https://stackoverflow.com/questions/4865573/ie-6-local-html-link-broken-net-webbrowser

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