I have a website (let's call it www.abc.com) that I need to put a redirect on. The landing page is www.abc.com/index.html so the redirect needs to be on that page. The redirect needs to work if the referrer is null (someone types the domain in directly) or the referrer is coming from outside of the abc.com domain (e.g. google.com) in which it should redirect to www.abc.com/splash/index.html.
The closest thing I have come up with is the below but it is not working. When I go to abc.com it goes to the splash page which is good. But then when I click on the link on the splash page to go to abc.com it redirects back to the splash page again. Infinite loop. Not sure what to do here and any help is appreciated!
<script type="text/javascript" charset="utf-8">
if (document.referrer == '' || document.referrer.indexOf('www.abc.com') != -1) {
top.location="http://www.abc.com/splash/index.html";
}
</script>