Javascript is likely the best solution for this feature, although we could use a few more details about what you want to do. Forcing somebody to stare at the goodbye message for 3-7 seconds before the tab closes isn't a good idea in my opinion - a simple goodbye popup that can be Xed out of would work better if you ask me.