I have a website and I look for a way to replace all occurrences of a string, namely "#C50606" by "#2a6739" (a specific color appearing multiple times on a specific webpage of mine). In other words, I would like to access the content one can find by doing
Right click -> Show Page Source -> Resources
and then apply some replace
function before the page loads.
The problem is I don't know the best way to do it: JS, CSS, ... ? I tried with this JS but it strangely only changed few occurrences and hid all the page widgets.
<script type="text/javascript">
var code = document.body.innerHTML;
document.body.innerHTML = code.split("#C50606").join("#2A6739");
</script>
Thanks for your help.
EDIT : the biggest problem seems to find an alternative to document.body.innerHTML
.