停止 Web 浏览器控件自动更正用户输入的 URL

发布于 2024-12-01 16:43:17 字数 436 浏览 3 评论 0原文

背景: 我们在 Windows Forms .net 4 项目中使用 WebBrowser 控件。 这是为了允许用户编辑 html 电子邮件的文本。

问题:

我们能否阻止网络浏览器控件自动更正用户输入的文本? 例如,用户键入文本 http://www.randomwebsite.com,然后 Web 浏览器控件“有帮助地”使用 将该文本换行。标签。 如果可能的话,我想阻止这种行为,

最终结果:

最终我想要实现的是允许用户将图像的 URL 放入其中并使用我系统中的数据标签填写部分网址。 目前,用户必须进入查看源代码视图并删除 A 标签才能使其正常工作,这是一个非常糟糕的解决方案...

我可以听到支持台电话已经响了!

Background:
We're using the webbrowser control in a windows forms .net 4 project.
This is to allow users to edit the text of html emails.

Problem:

Can we stop the webbrowser control auto-correcting text the user types in?
For example the user types the text http://www.randomwebsite.com then the web browser control "helpfully" wraps that text with an <A> tag.
I want to stop this behaviour if at all possible,

The end game:

Ultimately what I'm trying to achieve is to allow users to put a URL to an image in and use data tags from my system to fill in part of the URL.
At the moment the user will have to go into a view source view and remove the A tags to get it to work, which is a very poor solution...

I can hear the support desk phones ringing already!!

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

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

发布评论

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

评论(1

半暖夏伤 2024-12-08 16:43:17

目前,我找到的唯一解决方案是捕获 keyup 事件,使用 TextRange 选择文本,然后使用 ExecCommand("unlink")< /code> 删除自动链接。

它的缺点是很难看,因为链接显示然后消失,但它确实有效。

At the moment, the only solution I have found is to trap the keyup event, select the text using a TextRange and then use ExecCommand("unlink") to remove the automated link.

It has the disadvantage of being ugly as the link is shown then disappears but it does work.

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