给定一个包含多个页面的 jQuery Mobile 应用程序
Home.html > Profile.html > Registration.html > ...
如何设置我的应用,使 Home
成为首先加载的页面,并在用户在移动设备上启动应用时呈现给用户?
最佳答案
这取决于你在做什么。
如果您要创建基本的移动网页,则这取决于您的网络服务器。如果您使用 Apache Web 服务器,您需要更改 httpd.conf 并将其替换为:
DirectoryIndex index.html
这样:
DirectoryIndex index.html main.html
或者,如果您无权访问您的网络服务器,您可以在项目目录中创建一个 .htaccess 并执行与上面相同的操作。了解更多相关信息 here 。
另一方面,如果您使用 Phonegap,那么您所需要做的就是更改 Phonegap 查找应用初始化的位置。
这是 Android 示例:
super.loadUrl("file:///android_asset/www/main.html");
了解更多信息 here 。
但是您应该遵守标准并将主文件重命名为index.html
iOS 有点不同,与 Android 不同,您需要更改一些配置,从而强制 iOS 加载与 index.html 不同的文件。
在 Classes 文件夹中打开 AppDelegate.m 并更改此内容:
self.viewController.startPage = @"index.html";
对此:
self.viewController.startPage = @"main.html";
关于java - 指定 jQuery 移动主页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23979859/