Detect active url then autonavigate to subdir

Discussion in 'Javascript' started by Hans Hasenack, May 4, 2004.

  1. This is the problem:
    I've got a home dir home.provider.nl/username

    and two registered domains www.firsturl.nl and www.nexturl.nl
    These are both pointing to the same home directory

    How can I (automatically) switch to another page based upon the url used for
    navigating to my home directory.

    some Restrictions
    * must be javascript or DHTML.
    * cannot be ASP
    * I cannot change the registerd domains to use a sub directory of my home
    dir, only the 'root' of my home dir

    TIA

    Hans

    Res
    Hans Hasenack, May 4, 2004
    #1
    1. Advertising

  2. Hans Hasenack

    kaeli Guest

    In article <4098028b$0$124$>,
    enlightened us with...
    > This is the problem:
    > I've got a home dir home.provider.nl/username
    >
    > and two registered domains www.firsturl.nl and www.nexturl.nl
    > These are both pointing to the same home directory
    >
    > How can I (automatically) switch to another page based upon the url used for
    > navigating to my home directory.
    >
    > some Restrictions
    > * must be javascript or DHTML.


    Why?
    This is best (easiest, simplist, and doesn't require anything from the
    client) done via server redirects. Anything else might not work on some
    browsers.
    Do you have Apache .htaccess available? If you don't know, ask your host
    or provide your host URL. Even a php script is preferable to a client-
    side script for something this integral to site functioning.

    If you insist on client-side, look at meta refresh tags, but be aware
    they are blockable/disabled on some browsers, including IE6.

    --
    --
    ~kaeli~
    Suicide is the most sincere form of self-criticism.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, May 5, 2004
    #2
    1. Advertising

  3. Hans Hasenack

    Shawn Milo Guest

    "Hans Hasenack" <> wrote in message news:<4098028b$0$124$>...
    > This is the problem:
    > I've got a home dir home.provider.nl/username
    >
    > and two registered domains www.firsturl.nl and www.nexturl.nl
    > These are both pointing to the same home directory
    >
    > How can I (automatically) switch to another page based upon the url used for
    > navigating to my home directory.
    >
    > some Restrictions
    > * must be javascript or DHTML.
    > * cannot be ASP
    > * I cannot change the registerd domains to use a sub directory of my home
    > dir, only the 'root' of my home dir
    >
    > TIA
    >
    > Hans
    >
    > Res




    Try this:

    //make window.location into a string
    var currentURL = '' + window.location;

    if (currentURL.match('firsturl')){
    window.location = 'http://www.google.com';
    }else{
    window.location = 'http://www.yahoo.com';
    }


    This works for me in IE6 and Mozilla Firefox.

    Shawn
    Shawn Milo, May 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michel Gallant
    Replies:
    0
    Views:
    399
    Michel Gallant
    Oct 14, 2005
  2. news-server

    View a list of files in a SubDir

    news-server, Jul 11, 2003, in forum: HTML
    Replies:
    1
    Views:
    418
    David Dorward
    Jul 11, 2003
  3. Peter Van Hove
    Replies:
    3
    Views:
    542
    Peter Van Hove
    Apr 22, 2005
  4. Dfenestr8
    Replies:
    5
    Views:
    359
    Cyril BAZIN
    Mar 7, 2005
  5. Replies:
    0
    Views:
    255
Loading...

Share This Page