1

我有带有 Crosswalk 16.45.421.19 的 Android 项目。

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

我有 index.html

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="/">
    <link rel="icon" href="img/favicon.ico" type="image/x-icon" />
</head>

<body>
    <img src="file:///android_asset/img/logo.png">
    <img src="file:///android_asset/img/preloaderWhite.gif">
    <div id="my-app">Привет!!!!</div>
</body>

</html>

xWalkWebView.load("file:///android_asset/index.html", null);  //All works!

当此文件在服务器上时:

xWalkWebView.load("http://192.168.0.102/", null); //Get index.html, but images don't load.

和:

Not allowed to load local resource: file:///android_asset/img/logo.png"
4

1 回答 1

-1

您好,请查看 CSP 内容安全策略https://developer.mozilla.org/en/docs/Web/Security/CSP我相信这是您的主题

于 2016-10-23T12:57:49.590 回答