Please disable your adblock and script blockers to view this page
 

how to redirect visitor from one website to another website using java script

Introduction: In previous articles I explained How to Fill CheckBoxList from Sql Server table in asp.net(C#,VB)  and Fill CheckBoxList based on DropDownList selection in asp.net(C#, VB)  and How to get CheckBoxList selected items in comma separated format in asp.net(C#,VB) and  how to  show Message box in asp.net website using JavaScript  and How to call java script function from code behind file in asp.net

Some times we require that when some one visit  www.abc.com  then he should be redirected to another site like www.xyz.com. So for that we need to add peace of javascript code in the head tag of the default page of the website and it will automatically redirect the www.abc.com  visitor to  www.xyz.com site. 

Lets create an web application to redirect visitor from one website to another website using JavaScript
  • In the <HEAD> tag create a JavaScript function as:
<head runat="server">
    <title></title>

    <script language="javascript" type="text/javascript">
       location.replace("http://www.xyz.com");    
    </script>
</head>

Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily.. ConversionConversion EmoticonEmoticon