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

**URL:** <https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037>\
**Category:** How-to Discussions\
**Created:** [February 12, 2017, 6:10pm UTC](https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037 "2017-02-12T18:10:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [February 12, 2017, 6:10pm UTC](https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037/1 "2017-02-12T18:10:55Z")

</div>

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

```auto
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".

```

---

<div class="post-metadata">

**Author:** ![Andreas\_Ronning](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/andreas_ronning/32/303_2.png) [@Andreas\_Ronning](https://forums.fusetools.com/u/Andreas_Ronning)\
**Post date:** [February 13, 2017, 9:12am UTC](https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037/2 "2017-02-13T09:12:21Z")

</div>

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](http://stackoverflow.com/questions/23857273/android-webview-refused-to-execute-inline-script)

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [February 13, 2017, 9:52am UTC](https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037/3 "2017-02-13T09:52:50Z")

</div>

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

```auto
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

```auto
    <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>

```

---

<div class="post-metadata">

**Author:** ![Tayyaba](https://avatars.discourse-cdn.com/v4/letter/t/f4b2a3/32.png) [@Tayyaba](https://forums.fusetools.com/u/Tayyaba)\
**Post date:** [April 1, 2021, 7:01am UTC](https://forums.fusetools.com/t/webview-refused-to-evaluate-a-string-as-javascript-because-unsafe-eval/5037/4 "2021-04-01T07:01:16Z")

</div>

@_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.
