指定jQuery移动主页面

时间:2014-06-01 12:27:29

标签: java android apache jquery-mobile cordova

给出一个包含多个页面的jQuery Mobile应用程序

Home.html > Profile.html > Registration.html > ...

如何设置我的应用,以便Home是首先加载的页面,并在用户在手机上启动应用时呈现给用户?

1 个答案:

答案 0 :(得分:1)

这取决于你在做什么。

如果您要创建一个依赖于您的Web服务器的基本移动网页。如果您正在使用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";