1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

help needed: Page Redirection

Discussion in 'JavaScript' started by informationHell, Jul 7, 2008.

  1. #1
    hello,
    i want to know that how to redirect ht*p://domain1.com/?AnyRandomNumber --> ht*p://domain2.com/?AnyRandomNumber


    redirection time should be 5 seconds..


    plz help.



    if url is

    abc.com/?123 ---> cde.com/?123
    abc.com/?abc ---> cde.com/?abc
    abc.com/?4s4 ---> cde.com/?4s4
    abc.com/?ax1 ---> cde.com/?ax1

    etc etc but with 5 second delay
     
    informationHell, Jul 7, 2008 IP
  2. bucabay

    bucabay Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In javascript you can use:

    window.location.href = 'http://domain2.com/?AnyRandomNumber'; 
    Code (markup):
    to redirect the page...

    to match the "AnyRandomNumber" part of the url, use the match() method or replace() method of the String.

    eg:

    var number = window.location.href.match(/[^\?]+$/);
    Code (markup):
     
    bucabay, Jul 7, 2008 IP
  3. anwaraa

    anwaraa Active Member

    Messages:
    167
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    Digital Goods:
    2
    #3
    There you go:
    
    <head>
    <script type="text/javascript">
    
    function run_it()
    {
    var fromUrl=window.location.href;
    var params=new Array();
    params=fromUrl.split("?");
    var destUrl="http://www.someurl.com/" + params[1]; 
    window.location.href = destUrl;
    }
    
    </script> 
    </head>
    <body onload="setTimeout('run_it()', 5000)">
    Code (markup):
     
    anwaraa, Jul 11, 2008 IP
    informationHell likes this.