id stringlengths 16 145 | text stringlengths 1 179k | title stringclasses 1
value |
|---|---|---|
Mmdn_fetch_File/819540cc6ee31eac647f_11_0.txt | Show Gist options | |
Mmdn_fetch_File/Mmdn_file_2_1.txt | t id="fileItem" type="file" />
The following line of code fetches the first file in the node's file list as a
[ ` File ` ](/en-US/docs/Web/API/File) object:
js
const file = document.getElementById("fileItem").files[0];
**Note:** This interface was an [ attempt to create an unmodifiable list
... | |
Mmdn_fetch_File/javascriptlabelhtml_30_0.txt | Cancel Submit feedback | |
Mmdn_fetch_File/applyjavascriptinter_45_0.txt | * [ Code ](/mdn/learning-area)
* [ Issues ](/mdn/learning-area/issues)
* [ Pull requests ](/mdn/learning-area/pulls)
* [ Actions ](/mdn/learning-area/actions)
* [ Security ](/mdn/learning-area/security)
* [ Insights ](/mdn/learning-area/pulse) | |
Mmdn_fetch_File/ab2c48cca03af052912b_3_0.txt | [ ](/) | |
Mmdn_fetch_File/819540cc6ee31eac647f_15_0.txt | * Embed Embed this gist in your website.
* Share Copy sharable link for this gist.
* Clone via HTTPS Clone using the web URL.
* * [ Learn more about clone URLs ](https://docs.github.com/articles/which-remote-url-should-i-use) | |
Mmdn_fetch_File/Mmdn_fetch_2_2.txt | nternet.
* [ MDN on Mastodon ](https://mozilla.social/@mdn)
* [ MDN on X (formerly Twitter) ](https://twitter.com/mozdevnet)
* [ MDN on GitHub ](https://github.com/mdn/)
* [ MDN Blog RSS Feed ](/en-US/blog/rss.xml)
## MDN
* [ About ](/en-US/about)
* [ Blog ](/en-US/blog/)
* [ Careers ](https://www... | |
Mmdn_fetch_File/Mmdn_fetch_5_1.txt | PI/Request/text)
6. Related pages for Fetch API
1. [ ` Headers ` ](/en-US/docs/Web/API/Headers)
2. [ ` Response ` ](/en-US/docs/Web/API/Response)
3. [ ` fetch() ` ](/en-US/docs/Web/API/fetch)
## In this article
* Constructor
* Instance properties
* Instance methods
* Examples
* Specifica... | |
Mmdn_fetch_File/ab2c48cca03af052912b_17_0.txt | * Save necolas/ab2c48cca03af052912bc2f1f633fb56 to your computer and use it in GitHub Desktop. | |
Mmdn_fetch_File/Mmdn_file_4_0.txt | * Skip to main content
* Skip to search
* Skip to select language
[ MDN Web Docs ](/en-US/) Open main menu
* References [ References ](/en-US/docs/Web)
* [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web)
* [ HTML Structure of content on the web ](/en-US/do... | |
Mmdn_fetch_File/819540cc6ee31eac647f_13_0.txt | * [ Star 0 ](/login?return_to=https%3A%2F%2Fgist.github.com%2FReine0017%2F819540cc6ee31eac647fd42503500d78) You must be signed in to star a gist
* [ Fork 0 ](/login?return_to=https%3A%2F%2Fgist.github.com%2FReine0017%2F819540cc6ee31eac647fd42503500d78) You must be signed in to fork a gist | |
Mmdn_fetch_File/819540cc6ee31eac647f_24_0.txt | confetti-button.js | |
Mmdn_fetch_File/ab2c48cca03af052912b_2_0.txt | [ All gists ](/discover) [ Back to GitHub ](https://github.com) [ Sign in
](https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fnecolas%2Fab2c48cca03af052912bc2f1f633fb56)
[ Sign up
](/join?return_to=https%3A%2F%2Fgist.github.com%2Fnecolas%2Fab2c48cca03af052912bc2f1f633fb56&source=header-
gist... | |
Mmdn_fetch_File/javascriptlabelhtml_42_0.txt | * [ Notifications ](/login?return_to=%2Fmdn%2Flearning-area)
* [ Fork 26.6k ](/login?return_to=%2Fmdn%2Flearning-area)
* [ Star 6.7k ](/login?return_to=%2Fmdn%2Flearning-area) | |
Mmdn_fetch_File/applyjavascriptinter_38_0.txt | [ Sign up
](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-
name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow&source=header-
repo&source_repo=mdn%2Flearning-area) | |
Mmdn_fetch_File/javascriptlabelhtml_36_0.txt | Cancel Create saved search | |
Mmdn_fetch_File/ab2c48cca03af052912b_31_0.txt | 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 ](https://github.co/hiddenchars) | |
Mmdn_fetch_File/ab2c48cca03af052912b_15_0.txt | * Embed Embed this gist in your website.
* Share Copy sharable link for this gist.
* Clone via HTTPS Clone using the web URL.
* * [ Learn more about clone URLs ](https://docs.github.com/articles/which-remote-url-should-i-use) | |
Mmdn_fetch_File/applyjavascriptinter_50_0.txt | # apply-javascript-internal.html | |
Mmdn_fetch_File/javascriptlabelhtml_2_0.txt | Toggle navigation | |
Mmdn_fetch_File/ab2c48cca03af052912b_39_0.txt | [ Sign up for free ](/join?source=comment-gist) **to join this conversation on
GitHub** . Already have an account? [ Sign in to comment
](/login?return_to=https%3A%2F%2Fgist.github.com%2Fnecolas%2Fab2c48cca03af052912bc2f1f633fb56) | |
Mmdn_fetch_File/applyjavascriptinter_22_0.txt | Search or jump to... | |
Mmdn_fetch_File/applyjavascriptinter_75_0.txt | document . addEventListener ( 'DOMContentLoaded' , ( ) => { | |
Mmdn_fetch_File/819540cc6ee31eac647f_9_0.txt | # [ Reine0017 ](/Reine0017) / **[ confetti-button.js
](/Reine0017/819540cc6ee31eac647fd42503500d78) ** | |
Mmdn_fetch_File/applyjavascriptinter_93_0.txt | * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [ Security ](https://github.com/security)
* [ Status ](https://www.githubstatus.com/)
* [ Docs ](https://docs.github.com/)
* [ Contact ](ht... | |
Mmdn_fetch_File/ab2c48cca03af052912b_43_0.txt | * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [ Security ](https://github.com/security)
* [ Status ](https://www.githubstatus.com/)
* [ Docs ](https://docs.github.com/)
* [ Contact ](ht... | |
Mmdn_fetch_File/applyjavascriptinter_19_0.txt | Repositories | |
Mmdn_fetch_File/819540cc6ee31eac647f_35_0.txt | You can’t perform that action at this time. | |
Mmdn_fetch_File/applyjavascriptinter_43_0.txt | * [ Code ](/mdn/learning-area)
* [ Issues 3 ](/mdn/learning-area/issues)
* [ Pull requests 3 ](/mdn/learning-area/pulls)
* [ Actions ](/mdn/learning-area/actions)
* [ Security ](/mdn/learning-area/security)
* [ Insights ](/mdn/learning-area/pulse) | |
Mmdn_fetch_File/applyjavascriptinter_78_0.txt | para . textContent = 'You clicked the button!' ; | |
Mmdn_fetch_File/Mmdn_file_0_0.txt | * Skip to main content
* Skip to search
* Skip to select language
[ MDN Web Docs ](/en-US/) Open main menu
* References [ References ](/en-US/docs/Web)
* [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web)
* [ HTML Structure of content on the web ](/en-US/do... | |
Mmdn_fetch_File/applyjavascriptinter_18_0.txt | * [ The ReadME Project GitHub community articles ](https://github.com/readme) | |
Mmdn_fetch_File/Mmdn_fetch_1_0.txt | * Skip to main content
* Skip to search
* Skip to select language
[ MDN Web Docs ](/en-US/) Open main menu
* References [ References ](/en-US/docs/Web)
* [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web)
* [ HTML Structure of content on the web ](/en-US/do... | |
Mmdn_fetch_File/ab2c48cca03af052912b_35_0.txt | **webdriver-button-test.js** | |
Mmdn_fetch_File/javascriptlabelhtml_14_0.txt | Resources | |
Mmdn_fetch_File/javascriptlabelhtml_50_0.txt | You can’t perform that action at this time. | |
Mmdn_fetch_File/Mmdn_fetch_5_0.txt | * Skip to main content
* Skip to search
* Skip to select language
[ MDN Web Docs ](/en-US/) Open main menu
* References [ References ](/en-US/docs/Web)
* [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web)
* [ HTML Structure of content on the web ](/en-US/do... | |
Mmdn_fetch_File/ab2c48cca03af052912b_41_0.txt | [ ](https://github.com "GitHub") © 2024 GitHub, Inc. | |
Mmdn_fetch_File/applyjavascriptinter_49_0.txt | 1. [ learning-area ](/mdn/learning-area/tree/main)
2. / [ javascript ](/mdn/learning-area/tree/main/javascript)
3. / [ introduction-to-js-1 ](/mdn/learning-area/tree/main/javascript/introduction-to-js-1)
4. / [ what-is-js ](/mdn/learning-area/tree/main/javascript/introduction-to-js-1/what-is-js) | |
Mmdn_fetch_File/applyjavascriptinter_92_0.txt | ### Footer navigation | |
Mmdn_fetch_File/ab2c48cca03af052912b_22_0.txt | Save necolas/ab2c48cca03af052912bc2f1f633fb56 to your computer and use it in
GitHub Desktop. | |
Mmdn_fetch_File/applyjavascriptinter_46_0.txt | ## Files | |
Mmdn_fetch_File/applyjavascriptinter_71_0.txt | < meta charset =" utf-8 " > | |
Mmdn_fetch_File/819540cc6ee31eac647f_34_0.txt | * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [ Security ](https://github.com/security)
* [ Status ](https://www.githubstatus.com/)
* [ Docs ](https://docs.github.com/)
* [ Contact ](ht... | |
Mmdn_fetch_File/javascriptlabelhtml_43_0.txt | * [ Code ](/mdn/learning-area)
* [ Issues 3 ](/mdn/learning-area/issues)
* [ Pull requests 3 ](/mdn/learning-area/pulls)
* [ Actions ](/mdn/learning-area/actions)
* [ Security ](/mdn/learning-area/security)
* [ Insights ](/mdn/learning-area/pulse) | |
Mmdn_fetch_File/javascriptlabelhtml_9_0.txt | * Solutions | |
Mmdn_fetch_File/applyjavascriptinter_41_0.txt | [ mdn ](/mdn) / **[ learning-area ](/mdn/learning-area) ** Public | |
Mmdn_fetch_File/ab2c48cca03af052912b_30_0.txt | **testIDs.js** | |
Mmdn_fetch_File/819540cc6ee31eac647f_16_0.txt | Clone this repository at <script
src="https://gist.github.com/Reine0017/819540cc6ee31eac647fd42503500d78.js"></script> | |
Mmdn_fetch_File/819540cc6ee31eac647f_3_0.txt | [ ](/) | |
Mmdn_fetch_File/applyjavascriptinter_15_0.txt | * [ Learning Pathways ](https://resources.github.com/learn/pathways)
* [ White papers, Ebooks, Webinars ](https://resources.github.com)
* [ Customer Stories ](https://github.com/customer-stories)
* [ Partners ](https://partner.github.com) | |
Mmdn_fetch_File/javascriptlabelhtml_11_0.txt | * [ Enterprise ](https://github.com/enterprise)
* [ Teams ](https://github.com/team)
* [ Startups ](https://github.com/enterprise/startups)
* [ Education ](https://education.github.com) | |
Mmdn_fetch_File/applyjavascriptinter_1_0.txt | ## Navigation Menu | |
Mmdn_fetch_File/ab2c48cca03af052912b_5_0.txt | You signed in with another tab or window. [ Reload ]() to refresh your
session. You signed out in another tab or window. [ Reload ]() to refresh
your session. You switched accounts on another tab or window. [ Reload ]() to
refresh your session. Dismiss alert | |
Mmdn_fetch_File/javascriptlabelhtml_48_0.txt | ### Footer navigation | |
Mmdn_fetch_File/applyjavascriptinter_30_0.txt | Cancel Submit feedback | |
Mmdn_fetch_File/applyjavascriptinter_61_0.txt | # apply-javascript-internal.html | |
Mmdn_fetch_File/Mmdn_fetch_4_1.txt | cs/Web/API/Headers)
, along with a [ ` fetch() ` ](/en-US/docs/Web/API/fetch) method for
initiating asynchronous resource requests. Because the main components of HTTP
are abstracted as JavaScript objects, it is easy for other APIs to make use of
such functionality.
[ Service Workers ](/en-US/docs/Web/API/Service_Work... | |
Mmdn_fetch_File/javascriptlabelhtml_24_0.txt | Search | |
Mmdn_fetch_File/Mmdn_fetch_1_3.txt | )
* [ Blog ](/en-US/blog/)
* [ Careers ](https://www.mozilla.org/en-US/careers/listings/?team=ProdOps)
* [ Advertise with us ](/en-US/advertising)
## Support
* [ Product help ](https://support.mozilla.org/products/mdn-plus)
* [ Report an issue ](/en-US/docs/MDN/Community/Issues)
## Our communities
* [... | |
Mmdn_fetch_File/applyjavascriptinter_48_0.txt | ## Breadcrumbs | |
Mmdn_fetch_File/Mmdn_fetch_7_0.txt | * Skip to main content
* Skip to search
* Skip to select language
[ MDN Web Docs ](/en-US/) Open main menu
* References [ References ](/en-US/docs/Web)
* [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web)
* [ HTML Structure of content on the web ](/en-US/do... | |
Mmdn_fetch_File/Mmdn_file_5_1.txt | (/en-US/docs/Web/API/File)
3. [ ` FileList ` ](/en-US/docs/Web/API/FileList)
4. [ ` FileReaderSync ` ](/en-US/docs/Web/API/FileReaderSync)
## In this article
* Constructor
* Instance properties
* Instance methods
* Events
* Specifications
* Browser compatibility
* See also
# FileReader... | |
Mmdn_fetch_File/819540cc6ee31eac647f_4_0.txt | [ Sign in
](https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2FReine0017%2F819540cc6ee31eac647fd42503500d78)
[ Sign up
](/join?return_to=https%3A%2F%2Fgist.github.com%2FReine0017%2F819540cc6ee31eac647fd42503500d78&source=header-
gist) | |
Mmdn_fetch_File/819540cc6ee31eac647f_28_0.txt | [ Show hidden characters ]({{ revealButtonHref }}) | |
Mmdn_fetch_File/ab2c48cca03af052912b_32_0.txt | [ Show hidden characters ]({{ revealButtonHref }}) | |
Mmdn_fetch_File/Mmdn_fetch_6_1.txt | ective of the resources it's retrieving.
**Note:** The ` fetch() ` method's parameters are identical to those of the [
` Request() ` ](/en-US/docs/Web/API/Request/Request "Request\(\)")
constructor.
## Syntax
js
fetch(resource)
fetch(resource, options)
### Parameters
` resource `
T... | |
Mmdn_fetch_File/Mmdn_fetch_0_1.txt | lative
## The problem
In the past we would resolve the relative URL against the current global, for
example:
js
let absolute = new URL(relative, window.location.href);
This is not a problem as such. It is just that different APIs that exhibit
this kind of behavior were doing it inconsistently ... | |
Mmdn_fetch_File/applyjavascriptinter_14_0.txt | Resources | |
Mmdn_fetch_File/applyjavascriptinter_8_0.txt | * [ All features ](https://github.com/features)
* [ Documentation ](https://docs.github.com)
* [ GitHub Skills ](https://skills.github.com)
* [ Blog ](https://github.blog) | |
Mmdn_fetch_File/Mmdn_file_1_1.txt | s synchronous I/O that
could potentially block.
## Constructor
[ ` FileReaderSync() ` ](/en-US/docs/Web/API/FileReaderSync/FileReaderSync
"FileReaderSync\(\)")
Returns a new ` FileReaderSync ` object.
## Instance properties
This interface does not have any properties.
## Instance methods
[ ` FileReaderS... | |
Mmdn_fetch_File/applyjavascriptinter_20_0.txt | * [ Topics ](https://github.com/topics)
* [ Trending ](https://github.com/trending)
* [ Collections ](https://github.com/collections) | |
Mmdn_fetch_File/Mmdn_fetch_7_4.txt | "cors",
cache: "default",
});
fetchImage(myRequest);
` Request() ` accepts exactly the same parameters as the ` fetch() ` method.
You can even pass in an existing request object to create a copy of it:
js
const anotherRequest = new Request(myRequest, myInit);
This is prett... | |
Mmdn_fetch_File/Mmdn_file_6_6.txt | erHeight = 6;
const throbber = document.createElement("canvas");
throbber.classList.add("upload-progress");
throbber.setAttribute("width", throbberWidth);
throbber.setAttribute("height", throbberHeight);
img.parentNode.appendChild(throbber);
throbber.ctx = throbber.getContext("2d");
... | |
Mmdn_fetch_File/applyjavascriptinter_83_0.txt | } ) ; | |
Mmdn_fetch_File/ab2c48cca03af052912b_18_0.txt | [ Code ](/necolas/ab2c48cca03af052912bc2f1f633fb56) [ Revisions 2
](/necolas/ab2c48cca03af052912bc2f1f633fb56/revisions) | |
Mmdn_fetch_File/819540cc6ee31eac647f_22_0.txt | Save Reine0017/819540cc6ee31eac647fd42503500d78 to your computer and use it in
GitHub Desktop. | |
Mmdn_fetch_File/819540cc6ee31eac647f_19_0.txt | Embed | |
Mmdn_fetch_File/ab2c48cca03af052912b_12_0.txt | * [ Download ZIP ](/necolas/ab2c48cca03af052912bc2f1f633fb56/archive/4a8ed2936cf9165f4869b300bd3f861fcea3ddb0.zip) | |
Mmdn_fetch_File/Mmdn_file_1_2.txt | out)
* [ Blog ](/en-US/blog/)
* [ Careers ](https://www.mozilla.org/en-US/careers/listings/?team=ProdOps)
* [ Advertise with us ](/en-US/advertising)
## Support
* [ Product help ](https://support.mozilla.org/products/mdn-plus)
* [ Report an issue ](/en-US/docs/MDN/Community/Issues)
## Our communities
... | |
Mmdn_fetch_File/applyjavascriptinter_91_0.txt | [ ](https://github.com "GitHub") © 2024 GitHub, Inc. | |
Mmdn_fetch_File/javascriptlabelhtml_18_0.txt | * [ The ReadME Project GitHub community articles ](https://github.com/readme) | |
Mmdn_fetch_File/ab2c48cca03af052912b_27_0.txt | [ Show hidden characters ]({{ revealButtonHref }}) | |
Mmdn_fetch_File/819540cc6ee31eac647f_20_0.txt | * Embed Embed this gist in your website.
* Share Copy sharable link for this gist.
* Clone via HTTPS Clone using the web URL.
* * [ Learn more about clone URLs ](https://docs.github.com/articles/which-remote-url-should-i-use) | |
Mmdn_fetch_File/applyjavascriptinter_72_0.txt | < meta name =" viewport " content =" width=device-width " > | |
Mmdn_fetch_File/Mmdn_fetch_7_5.txt | rs ` ](/en-US/docs/Web/API/Request/headers) ).
* ` request-no-cors ` : guard for a headers object obtained from a request created with [ ` Request.mode ` ](/en-US/docs/Web/API/Request/mode) ` no-cors ` .
* ` response ` : guard for a headers object obtained from a response ( [ ` Response.headers ` ](/en-US/docs/We... | |
Mmdn_fetch_File/Mmdn_fetch_6_2.txt | source_Integrity) value of the request (e.g., `
sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= ` ).
` keepalive `
The ` keepalive ` option can be used to allow the request to outlive the page.
Fetch with the ` keepalive ` flag is a replacement for the [ `
Navigator.sendBeacon() ` ](/en-US/docs/Web/API/Navi... | |
Mmdn_fetch_File/Mmdn_file_5_3.txt | scord)
## Developers
* [ Web Technologies ](/en-US/docs/Web)
* [ Learn Web Development ](/en-US/docs/Learn)
* [ MDN Plus ](/en-US/plus)
* [ Hacks Blog ](https://hacks.mozilla.org/)
[ Mozilla logo ](https://www.mozilla.org/)
* [ Website Privacy Notice ](https://www.mozilla.org/privacy/websites/)
* [ Co... | |
Mmdn_fetch_File/applyjavascriptinter_54_0.txt | ## History | |
Mmdn_fetch_File/javascriptlabelhtml_47_0.txt | [ ](https://github.com "GitHub") © 2024 GitHub, Inc. | |
Mmdn_fetch_File/javascriptlabelhtml_8_0.txt | * [ All features ](https://github.com/features)
* [ Documentation ](https://docs.github.com)
* [ GitHub Skills ](https://skills.github.com)
* [ Blog ](https://github.blog) | |
Mmdn_fetch_File/javascriptlabelhtml_28_0.txt | We read every piece of feedback, and take your input very seriously. | |
Mmdn_fetch_File/ab2c48cca03af052912b_40_0.txt | ## Footer | |
Mmdn_fetch_File/javascriptlabelhtml_46_0.txt | ## Footer | |
Mmdn_fetch_File/applyjavascriptinter_17_0.txt | * [ GitHub Sponsors Fund open source developers ](https://github.com/sponsors) | |
Mmdn_fetch_File/applyjavascriptinter_16_0.txt | * Open Source | |
Mmdn_fetch_File/ab2c48cca03af052912b_11_0.txt | Show Gist options | |
Mmdn_fetch_File/javascriptlabelhtml_21_0.txt | * [ Pricing ](https://github.com/pricing) | |
Mmdn_fetch_File/applyjavascriptinter_33_0.txt | Name | |
Mmdn_fetch_File/ab2c48cca03af052912b_37_0.txt | [ Show hidden characters ]({{ revealButtonHref }}) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.