IE 6 本地 html 链接损坏 .NET 网络浏览器

发布于 2024-10-15 05:14:31 字数 2027 浏览 1 评论 0原文

我的应用程序中嵌入了一个 WebBrowser。我正在加载一个 html 文档,其中包含指向文档中其他部分的链接。这是如何创建链接的示例...

...
<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>
...

当我使用我的开发计算机(具有 IE 8)并且加载文档时,所有链接都可以正常工作。

当我在生产计算机(具有 IE 6)上加载文档并单击链接时,它会显示一个新页面,其中包含文本“blank#_Toc179681722”,没有其他内容。

注意:我可能会补充一点,这个 html 文档是从 Microsoft Word 创建的,我对更改语法没有太多控制权。

有人对正在发生的事情有想法吗?以及如何修复它?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

雄赳赳气昂昂 2024-10-22 05:14:32

您可以将“_Toc179681722”设置为您希望 a 元素定位的范围的 ID 吗?

显示新页面绝对是不寻常的,因为未找到的标签应该只是将您重定向到页面顶部而不会出现错误。 (参考

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)

拒绝两难 2024-10-22 05:14:31

我没有看到您的链接的结束标记

许多较新的浏览器会为您解决此问题,并重新解释 html。 IE6 可能无法做到这一点,导致 url 运行异常。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文