'Can a web page access elements injected by content?

If from my content script I inject an element into the DOM of a web page, can that web page (if it knows of my injection) read the content of my element?

If I inject:

const root = document.createElement('div');
root.id = 'extension-root';
root.innerText = 'can I be seen?';
document.body.insertBefore(root, document.body.firstChild);

Can the web page run:

document.getElementById('extension-root').innerText;

and see my text?

I checked this page which talks about the content script accessing the web page, but I didn't see anything going the other way around.

I'm assuming that the web page can not access the javascript in my content script, but this would be good to confirm as well.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source