Print Page | Close Window

Redirecting and Opening in a New Window

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=14703
Printed Date: 30 March 2026 at 3:03pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Redirecting and Opening in a New Window
Posted By: Misty
Subject: Redirecting and Opening in a New Window
Date Posted: 15 April 2005 at 2:17pm
I'd like to try something. I'd like to add target='_blank' to the code so it will open in a new window. But I am not sure how to do this.

Here's my current code:
 
Response.Redirect ("PrayerRequests.aspx")
 
I'd like for the web page to redirect to this web page. I want the web page to show up in a new window.
 



Replies:
Posted By: michael
Date Posted: 15 April 2005 at 2:41pm
reponse is serverside code has no knowledge of client windows, I would just use some client javascrip block based on your conditions.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Misty
Date Posted: 15 April 2005 at 3:09pm
This will not work for me. Does anyone know of any functions that I could use when I redirect a web page to make it refresh automatically?


Posted By: Mart
Date Posted: 15 April 2005 at 3:59pm
Response.Write("window.open('PrayerRequests.aspx','mywindow','width=400,height=200')")


Posted By: Misty
Date Posted: 15 April 2005 at 10:34pm
Mart,
 
It didn't work. I got "window.open('PrayerRequests.aspx','mywindow','width=400,height=200') " on the top of my web page. There may be a small error somewhere.


Posted By: Mart
Date Posted: 16 April 2005 at 7:28am
Sorry I meant

Response.Write("<script language=javascript>window.open('PrayerRequests.aspx','mywindow','w idth=400,height=200')</script>")


Posted By: Misty
Date Posted: 16 April 2005 at 1:26pm
I got the following error message:
Compiler Error Message: BC30648: String constants must end with a double quote.

Source Error:

Line 329:                 lblResultsTitle.Text = "<h3>Thank you for adding your prayer request! </h3>" 
Line 330:
Line 331:                 Response.Write("<script  language=javascript>window.open('PrayerRequests.aspx','mywindow','width=400,height=200')</scri pt>") 
Line 332:
Line 333:
I tried adding some things, but it still would not work. I am not sure what's wrong.


Posted By: dj air
Date Posted: 16 April 2005 at 1:37pm
not sure if its just a formatting error or not but the </script>  has a space.




Posted By: Misty
Date Posted: 16 April 2005 at 1:48pm
Originally posted by dj air dj air wrote:

not sure if its just a formatting error or not but the </script>  has a space.


 
There's actually no space in script. I am not sure why it showed space in the error message above. This was not what I saw in the error message.
 
Mart wrote:
Sorry I meant

Response.Write("<script language=javascript>window.open('PrayerRequests.aspx','mywindow','w idth=400,height=200')</script>")
 
I forgot to let you know that I already have Javascript code in the ASP.Net web page. The code is:
 
 <SCRIPT LANGUAGE=JAVASCRIPT>
 <!--
 
 //---------------------------------------------------------------
 // name: OpenNewWindow(destination)
 //---------------------------------------------------------------
 function OpenNewWindow(destination)
 {  
  //Note: be sure NOT to have spaces before or after the commas in the 'width... part of the
  //open method
 
     newWindow = window.open(destination, 'win1', '')
 }  
 // -->
 </SCRIPT>


Posted By: Misty
Date Posted: 18 April 2005 at 1:21pm
I have tried changing the code many times. I am still getting an error message. You can see a copy of my error message below. Can someone please help me with this code? Or maybe you could show me how to modify this code to work with target_blank.
 

Compiler Error Message: BC30648: String constants must end with a double quote.

Source Error:

 

 
Line 313:                 lblResultsTitle.Text = "<h3>Thank you for adding your prayer request! </h3>" 
Line 314:                 
Line 315:                 Response.Write("<script  language=javascript>window.open('PrayerRequests.aspx','mywindow','status=no,toolbar=no,scrollbars =yes,resizable=yes,width=400,height=200,top=0,left=0');</script>")  
Line 316:                 
Line 317:


Posted By: Mart
Date Posted: 18 April 2005 at 2:31pm
This should work

Response.Write("<")
Response.Write("script language=javascript>window.open('PrayerRequests.aspx','mywindow','status=no,toolbar=no,scrollbars

=yes,resizable=yes,width=400,height=200,top=0,left=0');</")
Response.Write("script")
Response.Write(">")

the problem is that you are probably using inline code, and you cannot have a <script> or </script> anywhere inside a <script runat="server"> block so you have to replicate it by doing it like that


Posted By: Misty
Date Posted: 18 April 2005 at 4:13pm
Originally posted by Mart Mart wrote:

This should work

Response.Write("<")
Response.Write("script language=javascript>window.open('PrayerRequests.aspx','mywindow','status=no,toolbar=no,scrollbars

=yes,resizable=yes,width=400,height=200,top=0,left=0');</")
Response.Write("script")
Response.Write(">")

the problem is that you are probably using inline code, and you cannot have a <script> or </script> anywhere inside a <script runat="server"> block so you have to replicate it by doing it like that
 
Thank you for your help! It finally worked.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net