close

[Solved] URL scheme must be “http” or “https” for CORS request

Hello Guys, How are you all? Hope You all Are Fine. Today I am just using fetch to get data but It shows the below message in the console URL scheme must be “http” or “https” for CORS request in Javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How URL scheme must be “http” or “https” for CORS request Error Occurs ?

I am just using fetch to get data but It shows the below message in the console.

sandbox.js:1 Fetch API cannot load file:///C:/Users/ssc/Desktop/My_js/Automation/luigi.json. URL scheme must be "http" or "https" for CORS request

How To Solve URL scheme must be “http” or “https” for CORS request Error ?

  1. How To Solve URL scheme must be “http” or “https” for CORS request Error?

    To Solve URL scheme must be “http” or “https” for CORS request Error Try installing one of these. npm serve – Live server (an extension for Visual Studio Code if you are using that) whatever server that will work with your environment. Should work fine once you spin up a serve.

  2. URL scheme must be “http” or “https” for CORS request

    To Solve URL scheme must be “http” or “https” for CORS request Error Try installing one of these. npm serve – Live server (an extension for Visual Studio Code if you are using that) whatever server that will work with your environment. Should work fine once you spin up a serve.

Solution 1

Try installing one of these.

  1. npm serve – Live server (an extension for Visual Studio Code if you are using that)
  2. whatever server that will work with your environment.
  3. Should work fine once you spin up a server

Solution 2

Close chrome (or chromium) and restart with the --disable-web-security argument. I just tested this and verified that I can access the contents of an iframe with src=”http://google.com” embedded in a page served from “localhost” (tested under chromium 5 / ubuntu). For me the exact command was:

Kill all chrome instances before running command

chromium-browser --disable-web-security --user-data-dir="[some directory here]"

The browser will warn you that “you are using an unsupported command line” when it first opens, which you can ignore.

From the chromium source:

// Don't enforce the same-origin policy. (Used by people testing their sites.)
const wchar_t kDisableWebSecurity[] = L"disable-web-security";

Before Chrome 48, you could just use:

chromium-browser --disable-web-security

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment