Website redirect with JS?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Posting2002

    #1

    Website redirect with JS?

    Hi, I am trying to keep a specific subdomain from seeing my webpage,
    something like

    192.168.X.X

    Would it be possible to have a start-up JavaScript which checks the IP and
    then if it falls in those ranges to redirect them to Yahoo for example, and
    if it doesn't then to load the website normally?


    THANKS!!!


  • Richard Cornford

    #2
    Re: Website redirect with JS?

    "Posting200 2" wrote:[color=blue]
    > Hi, I am trying to keep a specific subdomain from seeing my
    > webpage, something like
    >
    > 192.168.X.X
    >
    > Would it be possible to have a start-up JavaScript which
    > checks the IP and then if it falls in those ranges to redirect
    > them to Yahoo for example, and if it doesn't then to load the
    > website normally?[/color]

    There is no cross browser client-side method of reading an IP address.

    Javascript is neither reliable enough, nor secure enough to "prevent"
    anything anyway (anything attempted with javascript can be subverted or
    by-passes by anyone who knows what they are doing. And javascript can be
    disabled, and in some cases very selectively (so it only applies to the
    page with your re-direct script, for example).

    Blocking and re-directing base on IP addresses is something that can
    only reasonably be handled on the server.

    Richard.


    Comment

    Working...