I need to make a console error after this commands:
location = 'http://example.com/';
location.href = 'http://example.com/';
So there will be no redirect after that.
It is about the location object. No need onbeforeunload because it is a workaround (which I know) and because I need to know/see (as a variant, in console) the target url without/before redirecting, onbeforeunload can't help with this.