Welcome Guest Search | Active Topics | Sign In | Register

Exception on adding script using EvalScript Options
khurram.saddique
Posted: Tuesday, December 14, 2021 9:09:09 AM
Rank: Newbie
Groups: Member

Joined: 7/31/2017
Posts: 2
Hi,
My project was working fine unit i upgraded EO.WebBrowser v20.3.63 to EO.WebBrowser v21.3.18. I'am facing an exception when running this code.
Code: C#

// script is jquery.min.js content string.
WebView.WebView.EvalScript(script);

the exception i returned is:

line 3, col 3694 - 3695: Uncaught TypeError: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment.

Can you guide me how to rectify the problem.
eo_support
Posted: Tuesday, December 14, 2021 10:08:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

This is because the author of the page has specified a content security policy that requires trusted types. Older browser engine does not support this policy so it is ignored. However newer browser engine supports and would enforce this policy thus causing your JavaScript code to fail. You can see more details about this policy and possible remedies here:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/require-trusted-types-for

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.