Anybody know the JScript that will do the same thing... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Anybody know the JScript that will do the same thing...

FSUKXAZFSUKXAZ Posts: 26Member
Anybody know the JScript that will do the same thing as this ASP code. I need it for another application that is running on a UNIX box (which does not read asp)

Here is the code:

<%if Request.ServerVariables("SERVER_NAME") = "sdi-web-dev-sm.xxx.xxxx.com"then%>
winNew = window.open("https://prismdev1.xxx.xxx.com")
<%elseif Request.ServerVariables("SERVER_NAME") = "fac-web-test.xxx.xxxx.com" then%>
winNew = window.open("https://prismqas.xxxx.xxxx.com")
<%elseif Request.ServerVariables("SERVER_NAME") = "pips.xxx.xxxx.com" then%>
winNew = window.open("https://prism.xxxx.xxxx.com")
<%end if%>

This ASP Code checks to see what environment you’re in (Development, Test, or Production), and then directs you to the required site. I need some JavaScript code that will do the same thing. Thank You.

Comments

  • mac_doggiemac_doggie Posts: 488Member
    I had the same problem, My provider doesn't support ASP too.

    I use PHP now. Find out if your provider supports it and than go teach yourself PHP, its very simple to learn. see www.php.net

    greetzzz,

    mac
    from holland
  • FSUKXAZFSUKXAZ Posts: 26Member
    : I had the same problem, My provider doesn't support ASP too.
    :
    : I use PHP now. Find out if your provider supports it and than go teach yourself PHP, its very simple to learn. see www.php.net
    :
    : greetzzz,
    :
    : mac
    : from holland
    :

    Thank you. However, I need a solution to my problem. We use JavaScript here where I work as well as ASP and ColdFusion, so I would like to find out a solution to my problem in JavaScript. If anybody can help me I would appreciate it.
  • sempersemper Posts: 35Member
    : <%if Request.ServerVariables("SERVER_NAME") = "sdi-web-dev-
    : sm.xxx.xxxx.com"then%>
    : winNew = window.open("https://prismdev1.xxx.xxx.com")
    : <%elseif Request.ServerVariables("SERVER_NAME") = "fac-web-
    : test.xxx.xxxx.com" then%>
    : winNew = window.open("https://prismqas.xxxx.xxxx.com")
    : <%elseif Request.ServerVariables("SERVER_NAME")
    : = "pips.xxx.xxxx.com" then%>
    : winNew = window.open("https://prism.xxxx.xxxx.com")
    : <%end if%>
    :
    : This ASP Code checks to see what environment you’re in
    : (Development, Test, or Production), and then directs you to
    : the required site. I need some JavaScript code that will do
    : the same thing. Thank You.


    Hi...

    I don't know asp very well - but if understood your lines right, you would like to open different pages dependently from the actual browser's page/adress ? If so, you can get for e.g. the current document URL, then parsing it for the desired URL's and finally open the new window. Something like this comes out (very simple, no error & browser checking)...

    var wnd = Null;

    function ml_redirect()
    {
    var s = document.URL.toLowerCase();

    if (s.indexOf("sdi-web-dev-sm.xxx.xxxx.com") > -1)
    {
    wnd = window.open(....);

    return;
    }

    if (s.indexOf("fac-web-test.xxx.xxxx.com") > -1)
    {
    wnd = window.open(....);

    return;
    }

    etc...
    }

    I hope this helps you a little.

    Semper
  • FSUKXAZFSUKXAZ Posts: 26Member
    : : <%if Request.ServerVariables("SERVER_NAME") = "sdi-web-dev-
    : : sm.xxx.xxxx.com"then%>
    : : winNew = window.open("https://prismdev1.xxx.xxx.com")
    : : <%elseif Request.ServerVariables("SERVER_NAME") = "fac-web-
    : : test.xxx.xxxx.com" then%>
    : : winNew = window.open("https://prismqas.xxxx.xxxx.com")
    : : <%elseif Request.ServerVariables("SERVER_NAME")
    : : = "pips.xxx.xxxx.com" then%>
    : : winNew = window.open("https://prism.xxxx.xxxx.com")
    : : <%end if%>
    : :
    : : This ASP Code checks to see what environment you’re in
    : : (Development, Test, or Production), and then directs you to
    : : the required site. I need some JavaScript code that will do
    : : the same thing. Thank You.
    :
    :
    : Hi...
    :
    : I don't know asp very well - but if understood your lines right, you would like to open different pages dependently from the actual browser's page/adress ? If so, you can get for e.g. the current document URL, then parsing it for the desired URL's and finally open the new window. Something like this comes out (very simple, no error & browser checking)...
    :
    : var wnd = Null;
    :
    : function ml_redirect()
    : {
    : var s = document.URL.toLowerCase();
    :
    : if (s.indexOf("sdi-web-dev-sm.xxx.xxxx.com") > -1)
    : {
    : wnd = window.open(....);
    :
    : return;
    : }
    :
    : if (s.indexOf("fac-web-test.xxx.xxxx.com") > -1)
    : {
    : wnd = window.open(....);
    :
    : return;
    : }
    :
    : etc...
    : }
    :
    : I hope this helps you a little.
    :
    : Semper
    :

    WhooHoo! That's exactly what I need Semper, Thank You very much. I used document.location instead of window.open
    because they want to keep it in the same window. Here is the completed code that works:


    var wnd = null;
    function redirect()
    {
    var s = document.URL.toLowerCase();
    if (s.indexOf("prismdev1.xxxx.xxxx.com") > -1)
    {
    wnd = document.location("http://sdi-web-dev-xx.xxx.xxxx.com/xxxxxx/xxxx/xxxxx/xxxxxx");
    return;
    }
    else if (s.indexOf("prismqas.xxxx.xxxx.com") > -1)
    {
    wnd = document.location("http://fac-web-test.xxx.xxxx.com/xxxx/xxxx/xxxxx/xxxxxxx");
    return;
    }
    else if (s.indexOf("prism.xxxx.xxxx.com") > -1)
    {
    wnd = document.location("http://pips.xxx.xxxx.com/xxxx/xxxxxxx");
    return;
    }
    }


    xxxx

    xxxx



Sign In or Register to comment.