baseURI not valid in decorateCooked

I’m trying to do this:

I think I can use window.location.href instead, but thought I’d point out the inconsistent behavior.

I’m very new at this and don’t understand when I should use decorateCooked and when should I use onPageChange as you suggest, and what other events there might be.