0

This is Json Data

$scope.imageFileDisplayContent=
{
"indexFileDisplayContent": "PCFET0NUWVBFIGh0bWw+CjxodG1sPjxoZWFkPjxtZXRhI"
}

This is code written to convert 64base htmlfile to iframe

  <iframe class="url-preview" ng-src="{{trustSrc(item.indexFileDisplayUrl)}}"></iframe>

How can i display 64 bit html file data into iframe . Thanks in advance

  • See: https://stackoverflow.com/q/20045150/4110233 If its base64 encoded, why not just decode it using js and then pass it to `ng-src`? – TheChetan Sep 25 '17 at 08:05

1 Answers1

6

It looks like you need to tell the iframe src that the data you gave him is in a 64 bit encoded form or else he won't know what to do with it.

You should try adding "data:text/html;base64," before the base 64 data to let the browser know that's the data he has gotten.

Here is an example (with no ng but it should work the same with):

<iframe class="url-preview" src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+PGh0bWw+PGJvZHk+PGgxPkhlbGxvIHdvcmxkIDY0Yml0PC9oMT48L2JvZHk+PC9odG1sPg=="></iframe>
MennyMez
  • 2,426
  • 18
  • 18