- From: Daniel Bates <notifications@github.com>
- Date: Fri, 02 Jun 2017 10:52:18 -0700
- To: w3c/FileAPI <FileAPI@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/FileAPI/issues/82@github.com>
Subsection [Response Headers](https://w3c.github.io/FileAPI/#processing-media-types) of section [Dereferencing Model for Blob URLs](https://w3c.github.io/FileAPI/#requestResponseModel) of File API does not describe what to do when dereferencing a Blob URL that was constructed from raw data and does not have a type. What should we do?
**Example**
Open a page with the following markup:
```
<!DOCTYPE html>
<html>
<body>
<script>
var frame = document.createElement("iframe");
frame.src = URL.createObjectURL(new Blob(["<h1>Hello</h1>"]));
document.body.appendChild(frame)
</script>
</body>
</html>
```
What should happen?
Here is what various browsers do:
Browser | Observed behavior
------------ | -------------
Chrome Canary for Mac 61.0.3115.0 (Official Build) canary (64-bit) | Shows an iframe with `<h1>Hello</h1>` (verbatim) (i.e. renders content as plain text)
Firefox for Mac 53.0.3 (64-bit) | Shows an iframe with <h1>Hello</h1> (rendered as HTML)
Safari 10.1 (12603.1.24) | Downloads the contents associated with the blob URL to a file named "unknown"
Edge 38.14393.1066.0 (EdgeHTML 14.14393) | Shows an empty iframe
Internet Explorer 11 (11.1198.14393.0) | Shows an empty iframe
**Additional remarks:**
For comparison, modify the above example to construct the Blob with type "text/html" and open this page:
```
<!DOCTYPE html>
<html>
<body>
<script>
var frame = document.createElement("iframe");
frame.src = URL.createObjectURL(new Blob(["<h1>Hello</h1>"], {type: "text/html"}));
document.body.appendChild(frame)
</script>
</body>
</html>
```
Here is what the above browsers do:
Browser | Observed behavior
------------ | -------------
Chrome Canary for Mac 61.0.3115.0 (Official Build) canary (64-bit) | Shows an iframe with <h1>Hello</h1> (rendered as HTML)
Firefox for Mac 53.0.3 (64-bit) | Shows an iframe with <h1>Hello</h1> (rendered as HTML)
Safari 10.1 (12603.1.24) | Shows an iframe with <h1>Hello</h1> (rendered as HTML)
Edge 38.14393.1066.0 (EdgeHTML 14.14393) | Shows an empty iframe
Internet Explorer 11 (11.1198.14393.0) | Shows an empty iframe
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/issues/82
Received on Friday, 2 June 2017 17:52:55 UTC