encodeForHtml() 与 htmlEditFormat() [英] encodeForHtml() vs htmlEditFormat()
本文介绍了encodeForHtml() 与 htmlEditFormat()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
encodeForHtml()
(CF10 中的新功能)与 htmlEditFormat()
,它们有何不同?
encodeForHtml()
(new in CF10) vs htmlEditFormat()
, how are they different?
推荐答案
我觉得和java的OWASP ESAPI中的encodeForHTML函数是一样的.更安全地避免 XSS 攻击以使用 HTML 中的内容.
I think it is same as encodeForHTML function in java's OWASP ESAPI. More secure to avoid XSS attack to use content in HTML.
<cfsavecontent variable="htmlcontent">
<html>
<head>
<script>function hello() {alert('hello')}</script>
</head>
<body>
<a href="#bookmark">Book Mark & Anchor</a><br/>
<div class="xyz">Div contains & here.</div>
<IMG SRC=javascript:alert(&# x27XSS')>
<IMG SRC=javascript:alert('XSS')>
</body>
</html></cfsavecontent>
<cfoutput>#htmleditformat(htmlcontent)#</cfoutput>
<br />
<cfoutput>#encodeforhtml(htmlcontent)#</cfoutput>
这篇关于encodeForHtml() 与 htmlEditFormat()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文