被阻止:Android webView中的csp

问题描述 投票:1回答:1

我有一个用ReactJS编写的Web应用程序和使用NextJS呈现的服务器。它适用于所有浏览器,但是当我在Android webView中打开它时,我的所有请求都被阻止,原因是“csp:blocked”,如下面的屏幕截图所示。

我没有指定我自己的任何CSP政策。

这是我的next.config

/**
 * Disable public routes from "pages" folder.
 */
useFileSystemPublicRoutes: false,
/**
 * Change "__next" directory path.
 */
assetPrefix: '/store/__js',
webpack: (config) => {
    config.output.publicPath = `/store/__js${config.output.publicPath}` // eslint-disable-line no-param-reassign
    return config
},

csp:blocked in Android webView for web app written in NextJS

android reactjs google-chrome webview next.js
1个回答
1
投票

面对完全相同的问题,您需要在Android端的WebView设置中进行一些更改。

WebSettings webSettings = yourWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
yourWebView.loadUrl("yourWebUrl");
© www.soinside.com 2019 - 2024. All rights reserved.