停止 Web 浏览器控件自动更正用户输入的 URL
背景: 我们在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,我找到的唯一解决方案是捕获
keyup
事件,使用TextRange
选择文本,然后使用ExecCommand("unlink")< /code> 删除自动链接。
它的缺点是很难看,因为链接显示然后消失,但它确实有效。
At the moment, the only solution I have found is to trap the
keyup
event, select the text using aTextRange
and then useExecCommand("unlink")
to remove the automated link.It has the disadvantage of being ugly as the link is shown then disappears but it does work.