Windows 10 Edge: Version: 88.0.705.63, Date: 2021-02-05: Refused to evaluate a string as JavaScript because ‘unsafe-eval’

People on Windows 10 are reporting an issue since the update of Windows 10 Edge: Version: 88.0.705.63, Date: 2021-02-05
The error message they’re getting is:

Error in executeScript code: 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 ‘nonce-275f3493fb1c5f4e1758f3c8556a4@cc’ ‘strict-dynamic’ ‘report-sample’ ‘self’ *.pinterest.com *.pinimg.com .google.com connect.facebook.net *.googleanalytics.com +.facebook.com *.googleadservices.com *.doubleclick.net *.googletagmanager.com *. adyen.com *.adyenpayments.com .bnc.lt bnc lt branch.io cdn. ampproject.org *.cdn.ampproject.org radar.cedexis.com *. cedexis-test.com www.gstatic.com/recaptcha/ unsafeinline’ *.youtube.com *.ytimg.com *.youtube.com *.ytimg.com”.

All was ok before the update.
The command being executed is
executeScript document.title = ${myTabTitle};

This seems to be a website issue, see 'unsafe-eval' is not an allowed source of script - #2 by ulrich

Or does it still work in Chrome on the machine?

Does storeText or storeAttribute work to get the page title?

1 Like

Sorry for my misleading initial assumption about what was causing the fault.
I agree, it’s an issue with the website that is opened in the tab. It happens in Firefox as well.

Thanks for the suggestion but I’m setting the document.title, not getting it.
executeScript_Sandbox fails as well.

Is there an alternative way of setting the document.title?

Yes, because of the Sandbox. It works for scripts that do not need website access.

Is there an alternative way of setting the document.title?

If the website blocks it… I guess not. But why do you need to change the website title?

It’s a long story…
The tab usually autocloses but sometimes doesn’t.
Sometimes more than one tab opens when only one is requested to open.
When that happens, I need to be able to identifty the correct tab. So when I open the tab, I name it so that I can switch to it a little later and be sure I’m switching to the right one.
Using this approach, I can then deal with the right tab correctly, make sure I have and then switch back to tab 0 and close all tabs to the right.
Well, you asked :wink:

Interesting info. I have no good idea right now… except maybe to work with visual automation on this website. This can not be blocked by a website.

Thanks for the suggestion. I’ll put your idea on the back-burner as I don’t want to have to change the whole paradigm of my macro - unless forced :wink: