How to redirect a blog using javascript

Discussion in 'JavaScript' started by spjain81, Aug 2, 2006.

  1. #1
    Hi all,

    I want to redirect a blog to another url using javascript. can anyone tell me the process? Any Ideas are welcome. Thanks in advance.
     
    spjain81, Aug 2, 2006 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    window.location="http://www.yourdomain.com/";

    or

    location.replace("http://www.yahoo.com");

    - I believe the first option is more compliant and supported
     
    ccoonen, Aug 2, 2006 IP
  3. AnimeGround

    AnimeGround Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can also do it without javascript with meta redirect

    <meta http-equiv="Refresh" content="1;url=http://www.domain.com/link.html">
     
    AnimeGround, Aug 3, 2006 IP
  4. 1EightT

    1EightT Guest

    Messages:
    2,646
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    0
    #4
    also be aware that the source blog wont last long in google if you use a meta refresh or a java redirect.
     
    1EightT, Aug 3, 2006 IP
  5. Nafai

    Nafai Peon

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I prefer location.href='http://wwww.myurl.com';
     
    Nafai, Aug 7, 2006 IP