I have a pretty strange problem with jQuery:
I have a website (with Flask) at: http://localhost:5000/, it works perfectly. Now I’ve set up a subdomain, edited my /etc/hosts (I added 127.0.0.1 fonts.localhost), the subdomain uses exact same html (even less) but when I load the site jQuery gives me this error:
Uncaught TypeError: Cannot call method 'toLowerCase' of undefined. It is coming from the function uaMatch in line 884 of the uncompressed jQuery 1.7.2 file. The argument passed to the function must be undefined, uaMatch is just called a single time (line 925) with the userAgent, the userAgent is assigned at line 75: userAgent = navigator.userAgent. navigator.userAgent is "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19" (according to the debugging-console).
So I really don’t understand why I get this error, which just occurs on the subdomain. The important html of fonts.localhost:5000.
<!doctype html>
<title>test</title>
<meta charset=utf-8>
<link rel=stylesheet type=text/css href="http://localhost:5000/static/style.css">
<link rel=stylesheet type=text/css href="http://localhost:5000/static/bootstrap.min.css">
<script type=text/javascript src="http://localhost:5000/static/jquery-1.7.2.min.js"></script>
<body>
…
</body>
EDIT:
It also doesn’t work with jQuery uncompressed (I also included the jQuery files hosted at google for testing, the same error)
Oh dear, I finally found the error, seems like jQuery can’t handle domains with no TLD, I changed the hosts entry from
127.0.0.1 fonts.localhostto127.0.0.1 fonts.localhost.localdomain, after this change jQuery worked. Is it worth a bugreport?