toStaticHTML功能不能很好地工作 [英] toStaticHTML function doesn't work well
问题描述
我遇到过像这篇帖子谈到的问题
我从网上获得了一些不受信任的html内容,并将内容放入我的应用中,使用innerHTML
然后我发现某些内容无法显示为预期,以及上面帖子中标记的错误发生。
所以我使用th函数toStaticHTML来过滤内容
但它似乎不起作用好吧,仍然有一些内容不能错好,错误也一样。
这是我的代码:
var list = new WinJS.Binding.List();
//许多项目包含不受信任的内容
items.forEach(function(item){
//过滤内容
item.htmlContent = toStaticHTML(item.content);
list.push(item);
});
< article class =" article-content" data-win-bind =" innerHTML:htmlContent">< / article>
请帮忙! thx!
Josh发布了有关如何解决这个问题的信息。
-Jeff
I met the problem like this post talked about
I get some untrusted html content from web, and put the content in my app, use innerHTML
then I found some content can't display as expected, and the error which marked in the post above occur.
so I use th function toStaticHTML to filter the content
but it seems not work well, there are still some content can't not dispaly well, and the error occur the same.
here is my code:
var list = new WinJS.Binding.List(); // many items contain untrusted content items.forEach(function (item) { // filter the content item.htmlContent = toStaticHTML(item.content); list.push(item); });
<article class="article-content" data-win-bind="innerHTML: htmlContent"></article>
please help! thx!
Josh posted information about how to work around this in his post toward the bottom.
-Jeff
这篇关于toStaticHTML功能不能很好地工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!