However, iframes are not deprecated, but they are frames. Is it a bad practice to use them?
Sometimes you need to embed a separate HTML document in another, and that's all right. For writing, HTML5 has a whole section devoted to embedding external content, one of the corresponding elements of which is iframe ( W3C HTML5 ).
Of course, something good or bad practice also depends heavily on your precedent, but the most practical questions tend to be quite broad in nature.
Also, can iframes be displayed for data: png / base64 or whatever, just like canvases can?
Actually, yes, although IE does not support data:text/html at the moment :
<iframe src="data:text/html,<!DOCTYPE html><html><body><p>abc"></iframe>
However, this is not the βrightβ way to do this (even the validators disagree on whether the syntax is correct) the W3C Nu validator does not seem to like data:text/html because of all the HTML characters, while Validator. nu only complains about unwritten spaces in DOCTYPE). To embed raw HTML, you need to use the new srcdoc attribute instead of src (which has even less browser support ):
<iframe srcdoc="<!DOCTYPE html><html><body><p>abc"></iframe>
So, in general, specifying raw HTML for iframes is a bad idea for today, and even when browsers start supporting the srcdoc attribute, you should use this by the data URI with the src attribute.
Boltclock
source share