toStaticHTML功能不能很好地工作 [英] toStaticHTML function doesn't work well

查看:115
本文介绍了toStaticHTML功能不能很好地工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到过像这篇帖子谈到的问题


http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/e35017b4-e21b-4807-8668-fc3c332c6b32


我从网上获得了一些不受信任的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

http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/e35017b4-e21b-4807-8668-fc3c332c6b32

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆