Ionic Framework - HTML rel导入适用于模拟器,但不适用于设备 [英] Ionic Framework - HTML rel import works on emulator but NOT on device

查看:127
本文介绍了Ionic Framework - HTML rel导入适用于模拟器,但不适用于设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将名为helper.html的特定html页面的内容(导入CSS和JavaScript文件的引用)导入另一个名为navigation.html的html页面。它适用于模拟器(可以导入helper.html的CSS和JavaScript文件的引用)但不在设备上(我使用的设备是Android平板电脑)。

I am trying to import the contents (import the reference of the CSS and JavaScript files) of a particular html page, named "helper.html" to another html page,named "navigation.html". It works on the emulator (the reference of the CSS and JavaScript files of the "helper.html" can be imported) but NOT on the device (the device I am using is Android tablet).

我的项目目录如下所示:

My project directory looks like this:

www

-templates

-templates


  • navigation.html(在模板文件夹内)

-helper.html(在www内)

-helper.html (inside www)

在我的navigation.html中,我有以下代码段:

In my "navigation.html", I have the following code snippet:

<!DOCTYPE html>
<html>
<head>
<link rel="import" href="helper.html">
</head>
<body>
 <ion-view view-title="Navigation">
    <ion-content>
  // SOME CODES
 </ion-content>
    </ion-view>

 </body>
 </html>

在我的helper.html中,我有以下代码片段:

In my "helper.html", I have the following code snippet:

<!DOCTYPE html>
<html>
<head>
 <title></title>
<link rel="stylesheet" href="css/pathFindingstyle.css" />
  <!-- Some JS files to be loaded, but I am not posting them here-->
 </head>
<body >
 <div id="draw_area"></div>
 <div id="stats"></div>
</body>
</html>

有人能告诉我如何在Android设备上运行这项工作吗?谢谢!

Can someone tell me a way how I could make this work on the android device? Thanks!

推荐答案

旧版本的Cordova for Android(< = 4.4.4)不使用Blink,Chromium / Chrome网络引擎,或者使用旧版本的Blink(< 36),它不实现Web组件(包括HTML Imports) - 用于HTML呈现。

Old versions of Cordova for Android (<= 4.4.4) don't use Blink, the Chromium / Chrome web engine, or use an old version of Blink (< 36) that doesn't implement Web Components -including HTML Imports- for HTML rendering.

因此你'我需要将Android升级到版本5+,或使用更新的设备来获得本机实现。

Therefore you'll need to upgrade Android to version 5+, or to use a more recent device to get a native implementation.

作为解决方法,您可以尝试使用 webcomponentsjs填充工具时,与 HTMLImports.js 模拟HTML Imports的文件(虽然我不知道它是否适用于您的Android版本)。

As a workaround, you can try to use the webcomponentsjs polyfill, with the HTMLImports.js file which emulates HTML Imports (though I don't know if it will work on your Android version).

这篇关于Ionic Framework - HTML rel导入适用于模拟器,但不适用于设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆