I realize that there are so many ways that people could enter a web site address, and I'm not trying to capture every possible way. Simply trying to capture the more common ways, and those that would include a space in them.

It looks like your wanting domain forwards or domain error handling; but this is not JavaScript... that does this. You could try to create a "catch all" in you htaccess file; to redirect the urls to your home page or an error page or where ever you want them to go.