Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / April 2005

Tip: Looking for answers? Try searching our database.

window.open not working during ASP.NET page refresh

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gridlock - 28 Apr 2005 19:38 GMT
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?

Thanks in advance.
Parijat - 28 Apr 2005 20:43 GMT
<script>
function newWindow() {
window.open("http://www.microsoft.com", "ms");
}
</script>
<body onload="newWindow()">

Try this
Gridlock - 28 Apr 2005 21:24 GMT
Thanks for the suggestion, but unfortunately this did not work.
Gridlock - 29 Apr 2005 16:06 GMT
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
work.  Any other suggestions?
Parijat - 28 Apr 2005 20:43 GMT
Try This
Put the window.open in a javascript function and call that function from the
main page's body onload event

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.