huertanix huertanix - 1 year ago 188
Less Question

Why is Bootstrap trying to load LESS files in Edge?

I have a web page using Twitter Bootstrap. It works well in Chrome, Firefox, and Safari. However, when I try to view it in Edge on Windows 10, I get a bunch of 403 errors saying it failed to load a slew of .less files from the Bootstrap CDN. Why are .less files being requested if the browser can't do anything with them? I am not using LESS at all, just plain CSS3, which is rendering just fine. How do I make this stop?

Deluge of unnecessary LESS file requests

Answer Source

The good news is this won't be affecting regular users of the site. The bad news is this is also happening in Chrome to some extent, it's just that the network tab in Chrome isn't reporting the 403 errors.

In the CSS file that you link to there is a line at the bottom of the file:

/*# */

This is the source maps and gives links to all the source files used to generate the minified CSS that is in your browser.

In the bootstrap instance the CDN is pointing to files that do not exist such as

The source map file will only be downloaded if you have source maps enabled and your dev tools open. Edge defaults source maps on and as far as I can tell there is no way to switch them off (but remember this will only happen when the dev tools are open, I have confirmed this behaviour using Fiddler), so when you press f12 then it's going to try and fetch the source mapped files. Chrome works slightly differently, it will download the source map but then will not attempt to download the .less file until you navigate to the source file.

If one of the .less files is returning a 403 Forbidden response Edge reports this in the network tab. Chrome dosen't.

If you use http debugger such as Fiddler you will see that Chrome does indeed request the files and also gets a 403 response, however, it doesn't report it on the network tab. When using Fiddler to get past the https issue I changed the CSS file to point to the non https URL. e.g:

The fix for this issue is to fix the files that are 403'ing in the source map. I have raised an issue on the bootstrap maxcdn GitHub repro:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download