Skip to main content

Redirection in javascript

How Page Re-direction works ?

Example 1:

This is very simple to do a page redirect using JavaScript at client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows:
<head>
<script type="text/javascript">
<!--
   window.location="http://www.newlocation.com";
-->
</script>
</head>
To understand it in better way you can Try it yourself.

Example 2:

You can show an appropriate message to your site visitors before redirecting them to a new page. This would need a bit time delay to load a new page. Following is the simple example to implement the same:
<head>
<script type="text/javascript">
<!--
function Redirect()
{
    window.location="http://www.newlocation.com";
}

document.write("You will be redirected to main page in 10 sec.");
setTimeout('Redirect()', 10000);
//-->
</script>
</head>
Here setTimeout() is a built-in JavaScript function which can be used to execute another function after a given time interval.
To understand it in better way you can Try it yourself.

Example 3:

Following is the example to redirect site visitors on different pages based on their browsers :
<head>
<script type="text/javascript">
<!--
var browsername=navigator.appName; 
if( browsername == "Netscape" )
{ 
   window.location="http://www.location.com/ns.htm";
}
else if ( browsername =="Microsoft Internet Explorer")
{
   window.location="http://www.location.com/ie.htm";
}
else
{
  window.location="http://www.location.com/other.htm";
}
//-->
</script>
</head>


Comments

  1. Hello Admin,

    I read your article and it is a great article. you share all information about redirection in java script.

    Regards,
    Thanks

    Mansi Sharma

    ReplyDelete
  2. Digital marketing is a powerful tool for businesses, but originality is essential. This article explores effective strategies to remove plagiarism in digital marketing. From content creation to citation practices, we will delve into actionable tips to ensure authenticity, enhance brand credibility, and achieve success in the digital landscape.
    if you want to know more Click

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Embarking on a camping adventure in Ladakh, amidst its majestic mountains and pristine wilderness, is an extraordinary journey that rejuvenates the spirit and leaves lasting memories.
    Nunkuncamp Shargole

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. As the demand for skilled digital marketers continues to rise, choosing the best institute to acquire comprehensive digital marketing knowledge and skills becomes crucial. Among the multitude of options in Delhi, one institute truly stands out as the epitome of excellence in digital marketing education. In this article, we unveil the unparalleled digital marketing institute in Delhi that is poised to shape your path towards remarkable success.
    Best Digital Marketing Institute in Delhi

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Digital marketing is an integral part of the modern business landscape, employing diverse techniques to connect and engage with online audiences. It encompasses a wide range of strategies that utilize digital channels such as social media, search engines, and email marketing to promote products or services and elicit desired actions from potential customers
    Best Digital Marketing Institute in Sarojini Nagar

    ReplyDelete
  11. Digital marketing refers to the utilization of various online channels, platforms, and technologies to promote products, services, or brands to a target audience. It involves leveraging digital mediums such as the internet, social media, search engines, email, mobile apps, and other digital platforms to reach potential customers and drive business growth. The primary objective of digital marketing is to engage with the audience, establish brand awareness, increase website traffic, generate leads, and ultimately convert these leads into customers.
    Best Digital Marketing Institute in Madipur

    ReplyDelete
  12. Digital marketing encompasses a broad spectrum of marketing efforts that leverage electronic devices and the internet to promote products and services. These efforts span across multiple online channels, including search engines, social media platforms, email, content marketing, and more.

    Best Digital Marketing Institute in Jhandewallan

    ReplyDelete
  13. One of the notable aspects of CA Firms is their ability to provide accurate and transparent financial reporting. They assist clients in maintaining clear and reliable financial records, which is essential for making informed business decisions and demonstrating financial health to stakeholders.
    CA Firm in Janakpuri

    ReplyDelete
  14. Rajouri Garden is also a hub for digital marketing education and training. Local institutes and training centers offer courses that equip individuals with the skills needed to excel in this field. These courses cover essential aspects of digital marketing, providing both beginners and experienced professionals with the knowledge to thrive in the digital landscape.

    Best Digital Marketing institute in Rajouri Garden

    ReplyDelete
  15. AUTISM, ALS, CANCER, COPD, ADHD, DDD, PTSD, or any kind of chronic disease/disorder can be so draining but literally has a cure and also a way to improve on them. Have you been searching for a cure or away to cope with the above mentioned and you haven’t found any and you’re about to give up. Well, I’m here to let you know that all hope is not lost, Dr kokobi is here to help you. His herbal Centre is a place where you can get a permanent cure, solution and also some vital info on how you can deal with any kind of disorder/disease you’re currently suffering from. I'm giving this testimony because he has helped me a lot. So kindly message him now via email:kokobiherbalremedycentre@gmail.com


    website: https://kokobiherbalremedycentre.weebly.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Trip to narsipura Sri Vaidya Narayana murthy - Shimago for cancer treatment

Hi friends. I would like to share my experience about my trip to Shimago and meet Guru Narayana murthy who would treat for cancer, diabetics, kidney diseases. My brother was diagnosed with rectal cancer on October 2014. The news of cancer to a young boy of 26 years shook our whole family. But we are strong as he was getting treatment from world class care clinic in Cleveland - Cleveland clinic, Ohio, USA. As fate had other plans, his cancer came in January, 2017 back after an extensive surgery, chemotherapy and radiotherapy. The doctors made a decision to keep him in hospice care: support for advanced illness. They said that there is no more treatment and only to keep him comfortable as long as he lives, we lost our hopes and that is when we thought of giving a try to Ayurvedic medicine. We found Guruji narasipura narayana murthy. His medicine gave us hopes and I recently went to narsipura to get the medicine. I thought it would be best to give my share of experience in reaching the

Solution to "child margin affects parent" in CSS

The browser implementation is that when the parent has no content and the child requests for margin, the parent is brought down instead of child going down. The solution for these are listed below with their side effects. floats , You  have  to float elements border-top , This pushes the parent at least 1px downwards which should then be adjusted with introducing  -1px  margin to the parent element itself. This can create problems when parent already has  margin-top  in relative units. padding-top , same effect as using  border-top overflow: hidden , Can't be used when parent should display overflowing content, like a drop down menu overflow: auto , Introduces scrollbars for parent element that has (intentionally) overflowing content (like shadows or tool tip's triangle) See the Pen Relative with Margin by Manikanta ( @immnk ) on CodePen .