all groups > dotnet jscript > april 2005 >
You're in the

dotnet jscript

group:

window.open not working during ASP.NET page refresh


window.open not working during ASP.NET page refresh Gridlock
4/28/2005 11:38:06 AM
dotnet jscript: I'm trying to open a new window from an existing window during the refresh of
the first window, but can't get this to work for some reason. An alert()
works, but not window.open. Here is the code:

<%@ Page language="c#" Codebehind="Home.aspx.cs" AutoEventWireup="false"
Inherits="WebReports.Home" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Home</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<P>Welcome<P>Please start by selecting one of the options below.</P>
</form>

<script>
window.open("http://www.microsoft.com", "ms");
</script>

</body>
</HTML>

If I replace the window.open with an alert, that works fine. What am I
doing wrong?

RE: window.open not working during ASP.NET page refresh Parijat
4/28/2005 12:43:26 PM

<script>
function newWindow() {
window.open("http://www.microsoft.com", "ms");
}
</script>
<body onload="newWindow()">

Try this
RE: window.open not working during ASP.NET page refresh Parijat
4/28/2005 12:43:29 PM
Try This
Put the window.open in a javascript function and call that function from the
RE: window.open not working during ASP.NET page refresh Gridlock
4/28/2005 1:24:16 PM
RE: window.open not working during ASP.NET page refresh Gridlock
4/29/2005 8:06:05 AM
Interestingly, 'onfocus' works but of course has problems in this context
since closing the popup and returning the focus to the main window
automatically reopens the popup. I don't understand why 'onload' doesn't
AddThis Social Bookmark Button