window.location opens the link in a new window

Discussion in 'Internet Explorer' started by Venkat, Oct 9, 2006.

  1. Venkat

    Venkat Guest

    Hi,

    I am using the following script to open a URL in the same window.

    <HTML>
    <HEAD>
    <TITLE>Test</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html">
    <script LANGUAGE="JavaScript">
    <!--
    function UrlRedirect()
    { this.location.href =
    ("http://localhost/Test2/Default.asp?fromShortcut=yes"); }
    </script>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" text="#c0c0c0" topmargin="0" onload="UrlRedirect()">
    </BODY>
    </HTML>

    I have created a short cut menu for this file say Redirect.html, When user
    clicks on short cut this page opens and redirects to Test2/default.asp in the
    same window. This was working in IE 6.0 and in IE7.0 in all the Operating
    Systems except on Vista RC1.
    I have tried the following script also and facing the same problem
    <html>
    <head>
    <title>Test</title>
    <meta http-equiv="refresh" content="0; URL=http://www.msn.co.in">
    <meta name="keywords" content="automatic redirection">
    </head>
    <body>
    </body>
    </html>
    I have tried the following script too and this also opens in a new window
    instead of the same window
    <html>
    <head>
    <title>Test 3</title>
    <script language="javascript" type="text/javascript">
    <!--
    window.location="http://www.msn.co.in";
    // -->
    </script>
    </head>
    <body>
    </body>
    </html>
    Please let me know how can I modify the script to open the redirected URL in
    the same window & tab. The above behavior i sobserved in Vista RC 2 with IE
    7.0.5744.16384. The same behavior is also observed in Vista RC1 with IE 7+
    Thanks in advance
     
    Venkat, Oct 9, 2006
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.