#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    74
    Rep Power
    11

    Unhappy javascript redirection


    Hi, I must create a redirect :

    1@mysite.com must open www.mysite.com and The url must remain 1
    @mysite.com

    I have obtain redirect correctly with this code :

    <script language="Javascript">
    <!--
    var indirizzo = window.location;
    if (indirizzo == 'http://www.mysite.com/') {
    location.href = "http://www.mysite.com/index_norm.php";
    }
    if (indirizzo == 'http://gest@mysite.com/') {
    location.href= "http://www.mysite.com/gest/";
    }
    if (indirizzo == 'http://biella@mysite.com/') {
    location.href= "http://www.mysite.com/biella/";
    }

    -->
    </script>

    NOW , this it's ok but the url change in the bar adress , so use this :

    <script language="Javascript">
    <!--
    var indirizzo = window.location;
    if (indirizzo == 'http://www.mysite.com/') {
    var dest = "http://www.mysite.com/index_norm.php";
    }
    if (indirizzo == 'http://gest@mysite.com/') {
    var dest= "http://www.mysite.com/gest/";
    }
    if (indirizzo == 'http://biella@mysite.com/') {
    var dest= "http://www.mysite.com/biella/";
    }
    -->
    </script>
    </head>

    <body>
    <FRAMESET ROWS="*,0" FRAMEBORDER=0 BORDER=0 FRAMESPACING=0>
    <FRAME SRC="WRITE VAR VALUE HERE" NORESIZE>
    </FRAMESET><noframes></noframes>
    </body>

    BUT, HOW can I write the var value in the body ?

    thks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    74
    Rep Power
    11
    I have changed and now I try whit this , but return error ??? Why ???


    <head>
    <script language="text/javascript">
    <!--//
    var indirizzo = window.location.href;
    var to_frame = "";
    if (indirizzo == 'http://www.mysite.com/') {
    to_frame = "http://www.mysite.com/index_norm.php";
    }
    else if (indirizzo == 'http://gest@mysite.com/') {
    to_frame= "http://www.mysite.com/gest/";
    }
    else if (indirizzo == 'http://biella@mysite.com/') {
    to_frame= "http://www.mysite.com/biella/";
    }
    else {
    to_frame= "http://www.mysite.com/index_norm.php";
    }
    var frame_direct= "<FRAMESET ROWS=\"*,0\" FRAMEBORDER=\"0\" BORDER=\"0\"
    FRAMESPACING=\"0\"><frame src=\""+to_frame+"\" noresize></FRAMESET>
    <noframes></noframes>";

    //-->
    </script>
    </head>
    <body>
    <script type="text/javascript">document.write(frame_direct);</script>
    </body>

IMN logo majestic logo threadwatch logo seochat tools logo