forked from mdn/content
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cecb3e
commit ba742ea
Showing
2 changed files
with
6 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,33 +54,13 @@ new Request(input, options) | |
|
||
### Exceptions | ||
|
||
<table class="no-markdown"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Type</th> | ||
<th scope="col">Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><code>TypeError</code></td> | ||
<td> | ||
Since <a href="/en-US/docs/Mozilla/Firefox/Releases/43">Firefox 43</a>, | ||
<code>Request()</code> will throw a TypeError if the URL has | ||
credentials, such as http://user:[email protected]. | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
- `TypeError` | ||
- The URL has credentials, such as `http://user:[email protected]` or cannot be parsed. | ||
|
||
## Examples | ||
|
||
In our [Fetch Request example](https://github.com/mdn/dom-examples/tree/main/fetch/fetch-request) (see [Fetch Request live](https://mdn.github.io/dom-examples/fetch/fetch-request/)) we | ||
create a new `Request` object using the constructor, then fetch it using a | ||
{{domxref("Window/fetch", "fetch()")}} call. Since we are fetching an image, we run | ||
{{domxref("Response.blob")}} on the response to give it the proper MIME type so it will be | ||
handled properly, then create an Object URL of it and display it in an | ||
{{htmlelement("img")}} element. | ||
In our [Fetch Request example](https://github.com/mdn/dom-examples/tree/main/fetch/fetch-request) (see [Fetch Request live](https://mdn.github.io/dom-examples/fetch/fetch-request/)) we create a new `Request` object using the constructor, then fetch it using a {{domxref("Window/fetch", "fetch()")}} call. | ||
Since we are fetching an image, we run {{domxref("Response.blob")}} on the response to give it the proper MIME type so it will be handled properly, then create an Object URL of it and display it in an {{htmlelement("img")}} element. | ||
|
||
```js | ||
const myImage = document.querySelector("img"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters