In my webpage from donain A I show another website from domain B in an iframe. I think website B can choose some fresh colors so I want to edit the background color of the body and change it to blue.
If I try this with javascript by getting the DOM of the iframe, and then editing the body's background color, I get a security error because website B is on another domain.
If open up the developer tools (F12) and I just edit the dom there it works fine.
So I'm really confused: why would a browser allow me to edit the dom by hand, but not by javascript? Obviously any kind of security measures this cross domain policy is supposed to imply is compromised by anybody who can press F12, thus it makes no sense for the browser to block access.
Alternatively, I could just scrape website B with my server, and put the (illegally) retrieved HTML inside my own website (with a nicer color). Again I bypassed the cross domain policy and thus did what the cross domain policy forbids me to do.
As a related question, is there anyway to change the color of an element with javascript inside an iframe without getting a cross domain error?