我有一个用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
},
面对完全相同的问题,您需要在Android端的WebView设置中进行一些更改。
WebSettings webSettings = yourWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
yourWebView.loadUrl("yourWebUrl");