-1

I'm writing an extension that runs a content script to update some elements on the DOM. The page giving me an issue is this one: https://app.crackingthecryptic.com/webapp/4mbb4Hg948

My code starts after all the DOM is loaded and run:

document.getElementsByClassName('sudoku-cell');

I'm expecting it to return a list of elements. If you check the debugger "Elements" you can easily find these elements in the DOM.

I don't understand why but if you run the above search in the console (Chrome / Firefox) with the "Javascript context: top" context it returns an empty list.

If you switch to "Javascript context: 4mbb4Hg948" then it returns the list of elements.

I believe this issue is related to some react context wizardry and I can't find how I would be able to access the updated DOM.

Regnoult
  • 2,224
  • 4
  • 15
  • 17

1 Answers1

0

It has nothing to do with React.

The document in the top window contains an iframe.

The 4mbb4Hg948 context is that iframe.

The document with the sudoku-cell elements in it is the one loaded into the iframe.

Quentin
  • 800,325
  • 104
  • 1,079
  • 1,205
  • How would I access the document: ``` x = document.getElementById('legacyapp') x.contentWindow.document ``` returns a "Uncaught DOMException: Blocked a frame with origin "https://app.crackingthecryptic.com" from accessing a cross-origin frame." EDIT: just read https://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame -> not possible – Regnoult Nov 15 '20 at 23:36