Friday, February 2, 2018

Data URLs - Include Data In-line In Web Pages

Data URLs, URLs prefixed with the data: scheme, allow content creators to embed small files inline in documents.

You can pass html directly to the url as given below.

<iframe src="data:text/html,<html><body><div>test</div></body></html>" height="100%" width="100%"></iframe>
<iframe src="data:text/html,data:text/html,<script>alert('hi');</script>" height="100%" width="100%"></iframe>

Or you can set base64 data in URL


<iframe src="data:application/pdf;base64,BASE64_DATA" height="100%" width="100%"></iframe>

No comments: