You need to be serving your index.html locally or have your site hosted on a live server somewhere for the Fetch API to work properly. The files need to be served using the http or https protocols.
If you just clicked on your index.html from your file explorer than your browser is grabbing those files directly from your file system. This is why the error is showing you an absolute path from the root folder on you computer.
Try installing one of these… – npm serve – Live server (an extension for Visual Studio Code if you are using that)
Or whatever server that will work with your environment.
Should work fine once you spin up a server 🙂 happy coding!
Related Posts:
- Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai
- Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai
- Syntax for an async arrow function
- Syntax for an async arrow function
- How to obtain username from Promise
? - TypeError: Cannot read property ‘then’ of undefined
- Using async/await with a forEach loop
- Why is my asynchronous function returning Promise {
} instead of a value? - TypeError: res.status is not a function
- Using setTimeout on promise chain
- ES6 Map in Typescript
- How do I color a hexagonal grid such that it doesn’t have neighbors of the same color?
- How to format a JavaScript date
- Wait 5 seconds before executing next line
- How to check whether a string contains a substring in JavaScript?
- Maximum call stack size exceeded error
- What is VanillaJS?
- JavaScript equivalent to printf/String.Format
- How to read a local text file?
- Open a URL in a new tab (and not a new window)
- Node.js heap out of memory
- JavaScript getElementByName doesn’t work
- jQuery.click() vs onClick
- Understanding nested for loops in javascript
- await is only valid in async function
- Tricky : ‘dict’ object is not callable
- Scroll to an element with jQuery
- Node.js – SyntaxError: Unexpected token import
- What is the “right” JSON date format?
- jQuery animate backgroundColor
- JavaScript get element by name
- How do I disable right click on my web page?
- Left() function in Javascript or jQuery
- Why is “forEach not a function” for this object?
- Completely disable scrolling of webpage
- How to fix RichEmbed Discord.js
- How to convert selected HTML to Json?
- Express error – TypeError: Router.use() requires middleware function but got a Object
- How to Open New window on every Click
- Jquery Ajax Call, doesn’t call Success or Error
- How to create a stopwatch using JavaScript?
- Uncaught TypeError: .indexOf is not a function
- Get all non-unique values (i.e.: duplicate/more than one occurrence) in an array
- How to set onClick with JavaScript?
- How does += (plus equal) work?
- Javascript Comparison Operators != vs !==
- onEnter not called in React-Router
- Find the largest palindrome made from the product of two 3-digit numbers – Javascript
- Javascript/Jquery Convert string to array
- How to interpolate variables in strings in JavaScript, without concatenation?
- Difference between “module.exports” and “exports” in the CommonJs Module System
- Discord error cannot read property ‘isFocused’
- onClick not working React js
- What language is JavaScript written in?
- How to output numbers with leading zeros in JavaScript?
- Remove not alphanumeric characters from string
- Scroll to bottom of div?
- How to sort in mongoose?
- “Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project
- How do you serve a file for download with AngularJS or Javascript?
- How can I cache image files locally with PhoneGap / Cordova?
- how to display a div triggered by onclick event
- Detect a finger swipe through JavaScript on the iPhone and Android
- JAX post error : Refused to set unsafe header “Connection”
- How to use onBlur event on Angular2?
- img onclick call to JavaScript function
- Bootstrap Collapse not Collapsing
- How to scroll to top of page with JavaScript/jQuery?
- Check if a JavaScript string is a URL
- Submit form without reloading page [duplicate]
- “React.Children.only expected to receive a single React element child” error when putting
and in a - What is the difference between Bower and npm?
- How to use Head JS with all enqueued scripts?
- How to add code to just before closing body tag
- Switch to the library tab in the media uploader
- Customizer JS API: Defining control settings
- Customizer JS API: Adding Setting Dynamically Not Working
- Updata Metadata WP Rest API
- Customizer JS API: Adding a “dropdown-pages” control
- Morris.js for WordPress?
- wp.editor.initialize does nothing
- Enqueue js script to footer
- Add A Tag To A Post Through JavaScript In Gutenberg UI?
- Setting/unsetting terms using the Backbone JavaScript client
- Load page in customizer preview on panel click?
- Make a script work within a page
- Add JavaScript to single post
- Post title not saving
- Failing to load my script files in wordpress! i can’t figure out what i’m doing wrong
- WordPress getting css and script files from client machine rather than the server machine
- wp_handle_upload returns a critical error response or invalid form submission
- How to load Javascript code or functions.php later in a child theme?
- Modal won’t appear on all pages
- Deferring Script wp-i18n causes a console error ‘wp is not defined’ – Gravityforms
- Get user in rest API endpoint
- Dynamically write in editor with Javascript
- How to change number field to text field using JS
- Custom Media Meta fields to alter the generated image HTML that is inserted into a post for my animated GIF image player?
- Uncaught SyntaxError: missing ) after argument list [duplicate]
- Styling parent based on a child element of a child in a WordPress page