Your code does seem to work, after running it and clicking in whatever <a> in a page it is redirecting.
There is a problem though, when the element <a> already has a href attribute to somewhere it will redirect to the href and to your url (in your example, bbc).
To fight this instead of assigning a new event “click” we can instead of the native functionality of the <a> tag and instead assign the value we want for the attribute href like so
const fixedWidth = document.querySelectorAll('a');
for (var i = 0; i < fixedWidth.length; i++) {
fixedWidth[i].setAttribute('href', 'https://www.bbc.co.uk');
}
This will change all of the <a>'s of a page to bbc regardless of them already having the href already or not and will not have the problem of double redirect
Note Mind you that if the page where you’re doing this has a “click” event on an <a> it will happen the same problem of double redirect making your href execute first and then the “click” event that is on the page