这是 Json 数据
$scope.imageFileDisplayContent=
{
"indexFileDisplayContent": "PCFET0NUWVBFIGh0bWw+CjxodG1sPjxoZWFkPjxtZXRhI"
}
这是为将 64base htmlfile 转换为 iframe 而编写的代码
<iframe class="url-preview" ng-src="{{trustSrc(item.indexFileDisplayUrl)}}"></iframe>
如何将 64 位 html 文件数据显示到 iframe 中。提前致谢
最佳答案
看来您需要告诉 iframe src 您提供给他的数据是 64 位编码形式,否则他将不知道如何处理它。
您应该尝试在 Base 64 数据之前添加“data:text/html;base64”,让浏览器知道这是他获取的数据。
这是一个示例(没有 ng,但它应该与以下内容相同):
<iframe class="url-preview" src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+PGh0bWw+PGJvZHk+PGgxPkhlbGxvIHdvcmxkIDY0Yml0PC9oMT48L2JvZHk+PC9odG1sPg=="></iframe>
关于javascript - 我如何在 Angular js 中将 64 位 HTML 文件显示到 iframe 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46398582/