-3

I am using style.less in my page for testing purpose but when i run it in browser using file protocol I am getting below exception

XMLHttpRequest cannot load file:///C:/Users/Desktop/Web/less_sample/style/style.less. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.

but when i run the same in localhost it is working. can somebody explain why it is so even though i have less.jsin both the case? thanks in advance.

prazor9
  • 137
  • 8

2 Answers2

1

Less requires to be running on a server to work. So when you are accessing it through the file:// protocol, it can not be processed. Using localhost means you are accessing it through the local server, and therefore the files can be processed.

rwacarter
  • 1,915
  • 1
  • 14
  • 25
0

The error says it all

When you are using localhost, you are using http:// and not file://

atmd
  • 7,430
  • 2
  • 33
  • 64