2

So, I wanted to execute some JavaScript into my Android app that is in Java, but when testing the JavaScript that has to run; in the Chrome Console (Ctrl-Shift-J), I get the following error:

Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.

The site is chess.com, and the error occurs when I run the following code:

document.body.innerHTML = document.body.innerHTML.replace(`<button type="button" class="ui_v5-button-component ui_v5-button-primary ui_v5-button-large ui_v5-button-full">
Play
</button>`, `<button type="button" id="jhghjikjhgbjinb" class="ui_v5-button-component ui_v5-button-primary ui_v5-button-large ui_v5-button-full">
Play
</button>`);

What I'm trying to do is access the "Play" button on this site and click it. Is there any other way to do the same? I tried using document.getElementsByClassName(), but how can I change the website's content?

The Amateur Coder
  • 789
  • 3
  • 11
  • 33

1 Answers1

1

interest-cohort permissions policy enables a site to declare that it does not want to be included in the user's list of sites for cohort calculation https://web.dev/floc/.

You can check if any content security policies (CSP) are enabled in the site.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Aghil Varghese
  • 360
  • 1
  • 10
  • 1
    Oh, thanks a lot. I checked but couldn't find if it is enabled or not, I guess it is though. If yes, how can I bypass or disable it or change the website's content? – The Amateur Coder Oct 19 '21 at 14:17
  • take a look https://stackoverflow.com/a/70915754/4205374 – hdoitc Jun 10 '22 at 06:25
  • @hdoitc, I don't own chess.com. It's apparently a company. How can I change the website's content? I don't have *direct* access to the website's code. How can I use JavaScript to get the elements? Or just bypass the error/exception/whatever it is so that I can continue changing the website's code? – The Amateur Coder Aug 09 '22 at 06:02