gpt4 book ai didi

javascript - jQuery TypeError "Cannot call method ' toLowerCase' 未定义”(函数 uaMatch)

转载 作者:行者123 更新时间:2023-11-28 09:53:45 25 4
gpt4 key购买 nike

我在 jQuery 方面遇到了一个非常奇怪的问题:

我有一个网站(带有 Flask):http://localhost:5000/,它工作得很好。现在我已经设置了一个子域,编辑了我的 /etc/hosts (我添加了 127.0.0.1 fonts.localhost),子域使用完全相同的 html (甚至更少)但是当我加载该网站时,jQuery 给出了这个错误:未捕获类型错误:无法调用未定义的方法“toLowerCase”。它来自未压缩的 jQuery 1.7.2884 行中的函数 uaMatch。文件。传递给函数的参数必须是未定义的,uaMatch 仅使用 userAgent 调用一次(第 925 行),userAgent 在第 75 行赋值: userAgent = navigator.userAgentnavigator.userAgent"Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19" (根据调试控制台)。

所以我真的不明白为什么会出现这个错误,它只发生在子域上。 fonts.localhost:5000 的重要 html。

<!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>

编辑:它也不适用于未压缩的 jQuery(我还包含了托管在 google 上的 jQuery 文件进行测试,同样的错误)

最佳答案

天哪,我终于发现了错误,好像 jQuery 无法处理没有 TLD 的域,我将主机条目从 127.0.0.1 fonts.localhost 更改为 127.0.0.1 fonts.localhost.localdomain,在此更改后 jQuery 起作用了。值得报告错误吗?

关于javascript - jQuery TypeError "Cannot call method ' toLowerCase' 未定义”(函数 uaMatch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10463366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com