DEV Community

suryadevelope
suryadevelope

Posted on

Preview my html code in iframe

I had an html file contains

If I show this in iframe in new tab the image is not loading as image file not exists in source pane I had that file as base64 data

Is there any library to show html preview which works similar to browser window to show my html code preview in javascript

Top comments (2)

Collapse
 
felipperegazio profile image
Felippe Regazio

Here is an example code of how you can accomplish that:
codepen.io/saigowthamr/pen/YjMwmV

Collapse
 
suryadevelope profile image
suryadevelope • Edited

Yes that's true but what if I had an image tag with src="/asserts/image.png" And ,image.png is in the form of base64 data in a variable in my javascript, now without changing the src of image tag into link or base64 or anything, how to show image tag (included in html) preview of ,image.png in iframe