Yes, that's possible. You can see the explanation here.
Code works in both body and footers (and I assume also headers) btw.