jquery移动应用程序无法使用jquryMobile框架JS和css文件的相对路径

jqueryMobile application is not working using jquryMobile framework js and css files relative path

本文关键字:css JS 文件 路径 相对 框架 jquryMobile 应用程序 移动 jquery      更新时间:2023-09-26

我正在使用jquerymobile framework创建一个应用程序。

我的应用程序在本地主机上按预期工作,但是一旦我将应用程序上传到服务器上,Javascript 和 css 就不起作用,我的应用程序用户界面和功能被破坏了。

如果我替换 javascript 和 css 相对路径

<link rel="stylesheet" href="webroot/css/jquery.mobile.css" />
<script src="webroot/js/jquery.js"></script>
<script src="webroot/js/jquery.mobile.js"></script>

到绝对 jquery移动框架路径

<link rel="stylesheet"  href="http://jquerymobile.com/test/css/themes/default/jquery.mobile.css" />
<script src="http://jquerymobile.com/test/js/jquery.js"></script>
<script src="http://jquerymobile.com/test/js/jquery.mobile.js"></script>

.它有效。

但是在本地主机上,JS和CSS文件的相对路径正在工作。

请建议,错误在哪里,在我的应用程序或jqueryMobile js和css文件中。

也许如果你尝试这个:

<link rel="stylesheet" href="/webroot/css/jquery.mobile.css">
<script src="/webroot/js/jquery.js"></script>
<script src="/webroot/js/jquery.mobile.js"></script>

注意开头的斜杠吗?

使用 filezilla 在服务器上上传文件时,我认为文件未成功上传。然后我将 filezilla 默认传输类型设置更改为二进制。不是它工作正常。

如果要更改此设置,请转到"编辑>设置">"连接>传输>文件类型

"

将"默认传输类型"自动更改为二进制。按确定按钮

它对我有用。