Fuse Community

webview - Refused to evaluate a string as JavaScript because 'unsafe-eval'

Hi, hope you guys are well , i’m running into an issue , I can’t evaluate any url within the webview , i’m getting this error

02-12 19:00:49.870 28943 28943 I chromium: [INFO:CONSOLE(1)] "Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src https://stats.g.doubleclick.net https://ajax.googleapis.com/ajax/libs/swfobject/ https://www.googleadservices.com https://www.google.com/recaptcha/api.js https://www.gstatic.com/recaptcha/api2/ https://apis.google.com https://mpsnare.iesnare.com https://cdn.mxpnl.com https://netverify.com/widget/jumio-verify/ https://*.stripe.com https://www.google-analytics.com https://b-stripecdn-com-ions.test.edgekey.net https://edgecast.stripecdn.com https://a.stripecdn.com https://cdn.plaid.com/link/ 'self' https://*.stripe.com https://*.stripecdn.com".

Hey, could you show some more of your code here? What is the actual JS you are trying to evaluate?
There are some restrictions on the kinds of JS you can legally execute in the context of a loaded webpage, as per this thread

Hi , i’m just trying to connect user to the stripe connect platform.
This is the code that i’m using.

function connectToStripe(){
  WhileTrueSet.value = true;
		url.value = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=CODE&scope=read_write";
}



function onPageLoaded(res){
console.log("WebView arrived at "+ JSON.parse(res.json).url);

}

The ux

    <NativeViewHost ux:Name="nvh" Background="#ddd">
      <Panel ux:Name="loadingIndicator" Opacity="0" Alignment="Bottom" Color="#0006">
          <Text Alignment="Center" Margin="10" Color="#fff">Loading...</Text>
      </Panel>
      <WebView ux:Name="webView" Url="{url}">
        <PageLoaded>
          <EvaluateJS Handler="{pageLoaded}">
            var result = {
              url : document.location.href
          };
          return result;
          </EvaluateJS>
        </PageLoaded>
        <WhilePageLoading>
            <Change loadingIndicator.Opacity="1" Duration="0.2" />
        </WhilePageLoading>
      </WebView>
      <AddingAnimation>
      <Change nvh.Opacity="0" Duration="0.3" />
    </AddingAnimation>
      </NativeViewHost>

@_Kobo were you able to resolve this issue? I am getting same issue while trying to connect stripe account in a web view of React Native app for android platform.