Is it okay to place HTML code between the ending of the head area and before the beginning of the body area. I have done this before, on various sites without any problems,
No, is not okay. All the content of the page should go inside <body>. Check the HTML specification.
Browsers are really forgiving, but even if it works you shouldn't do it.