Redirect user for specific time and return
<p>My aim is to redirect user to a specific website for 18 seconds and then redirect back to my website. To accomplish this, I have written the code below. The problem I am facing was that the website started to redirect in a loop so I had to come up with a condition to avoid that. For this I have putted a check if the user is coming from my redirected website or not but now the redirection isnt working at all. Please guide. Thanks</p>

<p>Note: startupsandfinance is the domain name from which the user gets redirected back.</p>

<pre><code>&lt;script type='text/javascript'&gt;
if !(( document.referrer.search(&amp;quot;startupsandfinance&amp;quot;))){


                        document.cookie=&amp;quot;toURL&amp;quot;+ &amp;quot;=&amp;quot; +escape(document.URL)+&amp;quot;;path=/; domain=.mycsnippets.com&amp;quot;;
                        document.cookie=&amp;quot;refURL&amp;quot;+ &amp;quot;=&amp;quot; +escape(document.referrer)+&amp;quot;;path=/; domain=.mycsnippets.com&amp;quot;;
                        this.location=&amp;#39;http://www.startupsandfinance.com/welcome.htm&amp;#39;;

}
&lt;/script&gt;
</code></pre>
