CKTIS / HTML
data: the resource embedded by object
Distinguish an embedded-resource URL from custom application data.
Version: HTML Living Standard
Syntax
<object data="/embedded.html" type="text/html">Fallback text</object>On object, the data attribute supplies a required, valid nonempty URL for the embedded resource. The type attribute can describe its MIME type. Depending on the response and support, the object can represent an image or a nested document, or display its fallback children. It is not a dictionary of custom values.
Do not confuse this attribute with data-prefixed attributes or the separate data element. Loading an object does not make foreign content trusted: origin rules, server restrictions and content security policy still apply. Provide useful fallback content and do not rely on obsolete plug-in technology.
The example embeds a local HTML document and reads its content after loading. That read is allowed because both documents have the same origin. The test proves actual nested-document loading, not permission to inspect a document from another site.
Examples
<!doctype html><meta charset="utf-8">
<object id="object" data="/embedded.html" type="text/html" width="300" height="100">Fallback text</object>
<output id="result"></output><script>
window.addEventListener('load', () => {
const object = document.querySelector('#object');
document.querySelector('#result').textContent = 'embedded=' + object.contentDocument.querySelector('#inside').textContent;
});
</script>Result
embedded=Local embedded document
Only the documented local child document is loaded; the test does not bypass the same-origin policy.