 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 16th, 2004, 03:42 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Response.redirect in new window
Hi
I have got a page that redirects users depending on their NT group memebership e.g
Case "Group A"
Response.redirect("Y.asp")
I need to redirect some of them to a page and that needs to open in a new window... This does not seem possible with VBS? Maybe add a JS function? Any sugestions welcome
Regards
Marnus
Such is Life!
|
|

March 16th, 2004, 12:34 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Response.Redirect is only going to work within the existing window. Instead, you need to write out some javascript to open the new window when the page is redrawn. Instead of redirecting, you just write out the JS.
window.open(...)
But watch out for popup blockers.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

July 12th, 2004, 05:07 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
I have been using this method for a while now but it seems like popup stoppers is starting to cause problems. Is there any other way to open a new IE window without the popup stoppers blocking it?
Regards
Marnus
|
|

July 12th, 2004, 05:23 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
There is a target attribute for HREF. You can set its value as _blank to open the link in a new window. For e.g. this link will open in a new window.
<a href="http://www.microsoft.com" target="_blank">Microsoft web site</a>
If you want to submit a form to a new page, the same attribute can be used in form tag.
BTW, could you please give some more details about the particular programming situation ? Then somebody may be able to give you better solution.
|
|

July 12th, 2004, 05:31 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
function ak_forecolor()
{
var mycolor = showModalDialog(subdirectory + "insertcolors.html", "", ");
}
this function wil be open a windows of that file
Numan
--------------------------------------------------
Love is the most beautiful thing of this world. So do this !
|
|

July 12th, 2004, 10:18 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Marnus,
I too can't think of anything other than Javascript - window.open(...) method to achieve this. May be you can explain more an what you are trying to do, so that one would come up with alternative solutions if any.
_________________________
- Vijay G
Strive for Perfection
|
|

July 13th, 2004, 01:55 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
Thanks for the replies. I have got a customer login page that authenticates on AD Accounts. So if the user logs in I check the group membership. Then I have got a "Select Case" to redirect them to a certian page/build a page depending oj the group. The one page is a Java App that doesnt look nice if it runs on the same page with the frames so I need to open this in a new window.
Regards
Marnus
|
|

July 18th, 2004, 07:30 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Use a function and call it in place of response.redirect. Like this...
<%
strLocation = "testlink.asp"
openlink(strLocation) ' replaces response.redirect
function openlink(link)
%>
<SCRIPT language='javascript'>window.open(' <%=strLocation%> ');</SCRIPT>
<%
end function
%>
Of course you can use all the parameters in the javascript for setting the new window, this is just a simple example of doing it in ASP. You could also use response.write inside of the code block instead of switching to HTML to create the function. your choice.
|
|

November 29th, 2004, 04:19 PM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Only thing you need to put the link in the js of the function because the function doesnt know what strLocation is.
So like this.
function openlink(link)
%>
<SCRIPT language='javascript'>window.open(' <%=link%> ');</SCRIPT>
<%
end function
|
|

August 29th, 2010, 07:03 PM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by acdsky
Hi
I have got a page that redirects users depending on their NT group memebership e.g
Case "Group A"
Response.redirect("Y.asp")
I need to redirect some of them to a page and that needs to open in a new window... This does not seem possible with VBS? Maybe add a JS function? Any sugestions welcome
Regards
Marnus
Such is Life!
|
TRY THIS:
In HTML code:
<script type="text/javascript">
function NewWindow() {
document.forms[0].target = "_blank";
}
</script>
<asp:Button runat="server" ID="btnprint" Text="Open in new window" OnClick="btnprint_Click" OnClientClick="NewWindow();" />
And in the Event Click of the button in vb.code:
Protected Sub btnprint_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect("pagina.aspx")
End Sub
=)
|
|
The Following User Says Thank You to aperezgzlz For This Useful Post:
|
|
|
 |