For example, which is the difference between these:
From MDN :
1. The content of the page that the embedded context is to contain. This attribute is expected to be used together with the sandbox and seamless attributes. If a browser supports the srcdoc attribute, it will override the content specified in the src attribute (if present). If a browser does NOT support the srcdoc attribute, it will show the file specified in the src attribute instead (if present).
So, the srcdoc
attribute overrides the content embedded using src
attribute.
Demo
Also, what you are saying about the following snippet data:text/html
is called Data URI and it has limitations..
2. Data URIs cannot be larger than 32,768 characters.
1. MDN, 2. MSDN