Re: <iframe doc="">

On Sat, 16 Jan 2010 20:03:49 -0500, Karl Dubost <karl+w3c@la-grange.net>  
wrote:

> How it is more practical than data?

Here's an example of @doc vs. @src="data:text/html,":

<!DOCTYPE html>
<html>
     <head>
         <meta charset="utf-8">
         <title></title>
     </head>
     <body>
         <iframe  
src="data:text/html;charset=utf-8,%3C!DOCTYPE%20html%3E%0D%0A%3Chtml%3E%0D%0A%20%20%20%20%3Chead%3E%0D%0A%20%20%20%20%20%20%20%20%3Cmeta%20charset%3D%22utf-8%22%3E%0D%0A%20%20%20%20%20%20%20%20%3Ctitle%3Etest%3C%2Ftitle%3E%0D%0A%20%20%20%20%3C%2Fhead%3E%0D%0A%20%20%20%20%3Cbody%3E%0D%0A%20%20%20%20%20%20%20%20%3Cp%3Etest%3C%2Fp%3E%0D%0A%20%20%20%20%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E"></iframe>
         <iframe  
src="data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw%2BDQo8aHRtbD4NCiAgICA8aGVhZD4NCiAgICAgICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPg0KICAgICAgICA8dGl0bGU%2BdGVzdDwvdGl0bGU%2BDQogICAgPC9oZWFkPg0KICAgIDxib2R5Pg0KICAgICAgICA8cD50ZXN0PC9wPg0KICAgIDwvYm9keT4NCjwvaHRtbD4%3D"></iframe>
         <iframe doc='<!DOCTYPE html>
<html>
     <head>
         <meta charset="utf-8">
         <title>test</title>
     </head>
     <body>
         <p>test</p>
     </body>
</html>'></iframe>
     </body>
</html>

@doc is way more readable (the @ value at least), easier to author by  
hand, and tends to use less bytes than data URIs (although that might  
depend on how much you have to use entities so the markup doesn't break  
out of the attribute).

But, as far as security, I don't remember what @doc has over @src="data:".  
I think it was mentioned though and had something to do with origin  
problems with src="data:".

-- 
Michael

Received on Sunday, 17 January 2010 01:55:25 UTC