Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 1
    "This only happens if I run the webpage directly in the file system (opening the .html file)" - I'd expect AJAX operations to fail in that scenario. It sounds like the test itself is invalid in this case. (Surely there's a duplicate I'm just not finding about AJAX requests to/from the file system...) Commented Jul 15, 2023 at 13:03
  • Do you understand mode: "no-cors". JavaScript can't access the body of the response. Commented Jul 15, 2023 at 13:04
  • @David as you commented above, I haven't found a question with this particular scenario (request in the file system). I don't know why this has been closed, related questions don't satisfy this issue, though, I understand the "no-cors" now. Commented Jul 17, 2023 at 18:57
  • @LucasDavidFerrero: What exactly is left to be satisfied for the issue? If you're trying to make an AJAX request to the file system then you can't do that. A file system is not a web server. In the question it sounds like the functionality works as expected when using a web server, so then is that not the solution? Commented Jul 17, 2023 at 18:59
  • 1
    To make it short: You won't find one. It's a security risk and modern browsers won't allow it. Commented Jul 17, 2023 at 20:01