In our app (web and mobile), we load in jQuery using either the Google CDN, or a normal tag. This loads in the requested source map (.map) file correctly, from the same directory as the requested jQuery file ('/assets/js').
However, we also use Ajax to load in specific JS files, one of which is jQuery Mobile. Because jQuery Mobile is being loaded by Ajax, for some reason it tries to load in the .map file from the root, rather than the 'assets/js' directory.
I know the simple solution is to drop the .map file into the root to get rid of the annoying 404 errors (or turn of source maps in Chrome), but I'd like to understand why this occurs when loading the JS files via Ajax.
Any ideas why this happens, and how to overcome it?
Similar question to earlier:
Error 'jquery-2.0.2.min.map not found'
Starting with jQuery 1.9, we also make available sourcemap files that can be used to debug the compressed file in sourcemap-aware browsers such as Google Chrome. The map file is not required for users to run jQuery, it just improves the developer's debugger experience.
So as long as you're seeing this in Chrome it is only for your benefit!
However to answer why this happens when loading from AJAX I guess it's because it references the source map relatively and your ajax is being called from a page on your server/document root.