本文介绍了阻止某些HTML标签在浏览器上呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have make a messaging system in which user can send messages to each other, they can also send files as attachement in message(its like simple email system). It allows users to send HTML characters and they'll render by browser, for eg if they enter
<b>Hello</b>
it'll rendered as Hello
Its working fine,however i am facing one problem if user enter
<iframe src="anywebsite"><iframe>
then it'll also rendered by browser as iframe
How can i allow only some particular characters to be rendered by browser rest will display as normal text I am using Asp.net MVC3
In my model class i've add
[AllowHtml] attribute to allow HTML characters
我已经使用过 HtmlSanitization库 [ ^ ]来呈现保存的HTML,但在iframe的情况下,它什么也不呈现,我想将iframe显示为纯文本
I''ve used HtmlSanitization Library[^] to render save HTML but in case of iframe it is rendering nothing and i want to display iframe as plain text
推荐答案
<text></text>
否则,您也可以使用
otherwise you can also use
<pre lang="HTML">
希望对您有帮助
hope this will help you
这篇关于阻止某些HTML标签在浏览器上呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!