I want to tag my mobile visitor with a specific URL like http://www.example.com.index.html?source=mobile i used this script to redirect visitors to the given url
<script type="text/javascript">
<!--
if (screen.width <= 800)
{
window.location ="http://www.example.com/index.html?source=mobile";
}
//-->
</script>
But when i used this script the page kept on loading again and again so i tried to add another condition in this script but i am confused how to make the second condition to stop loading again and again.
<script type="text/javascript">
<!--
if (screen.width >= 800)
{
window.location ="http://www.example.com/index.html?source=mobile";
}
Else if (document.referrer ="http://www.example.com/index.html?source=mobile")
{
//stop execution here
}
//-->
</script>
Now plz someone help me to stop execution of javascript if second condition is true.
Thanks in advance.