IE 6 本地 html 链接损坏 .NET 网络浏览器
我的应用程序中嵌入了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将“_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)
我没有看到您的链接的结束标记
。
许多较新的浏览器会为您解决此问题,并重新解释 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.