【问题标题】:How to change startup file index.html to other html file in phonegap如何将启动文件 index.html 更改为 phonegap 中的其他 html 文件
【发布时间】:2018-10-17 05:51:03
【问题描述】:

如何将启动文件 index.html 更改为 phonegap 中的其他 html 文件。我更改了 config.xml 文件中的内容 src="login.html" 但它不起作用。它总是加载 index.html 文件。请帮忙。非常感谢。

config.xml

<content src="login.html" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="14" />
<access origin="" />
<allow-intent href="http://*/" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>

【问题讨论】:

  • 你能分享整个配置文件吗?
  • ` `
  • 我还将所有文件中的所有 index.html 路径引用更改为 login.html,但它仍然无法正常工作。请告诉我如何在应用打开时更改登录页面的路径。
  • 检查/platforms/android/app/src/main/res/xml/config.xml 的配置以查看您的配置是否已更新。你是通过热重装来尝试这个吗?我不认为它会更新配置。

标签: cordova jquery-mobile phonegap-build phonegap phonegap-cli


【解决方案1】:

不知道为什么要从 index.html 以外的其他页面开始(将 login.html 重命名为 index.html 不是更容易吗?)

无论如何,你可以做的是有一个最小的 index.html 文件,通过添加这样的脚本标签重定向到 login.html:

   <script>
        window.location = './login.html';
    </script>

这是我在我的应用程序中使用的东西,因为如果 index.html 启动时间过长,cordova 可能会拒绝启动应用程序。

【讨论】:

  • 但它仍然首先加载 index.html 并重定向到 login.html。这需要更多时间。
  • 我认为几毫秒应该不是问题。特别是在您添加本机加载程序覆盖之后。但是现在如果用户登录会发生什么?您需要将他重定向到索引?
  • 实际上我希望我的第一页作为登录页面作为我的启动页面,然后加载索引页面。但是每当我打开我的应用程序时,它总是首先打开索引页面,然后在我使用 window.replace('login.html) 或 window.location='login.html' 时重定向到登录页面。有什么方法可以将加载页面 index.html 更改为自定义页面 html。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-10-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多