Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Embed html to iframe

16 Apr 2020 » web

src="data:text/html;charset=utf-8,'+escape(data)+'"

$('.wrapper-'+label).empty().append('<iframe scrolling="no" style="border:none;" src="data:text/html;charset=utf-8,'+escape(data)+'"></iframe>')

Python

import urllib.parse
html = "html code"
html = urllib.parse.quote(html)

print(f'<iframe widht="100%" height="400px" src="data:text/html;charset=utf-8,{html}></iframe>"')