p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Response.redirect in new window (http://p2p.wrox.com/showthread.php?t=10566)

acdsky March 16th, 2004 03:42 AM

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!

planoie March 16th, 2004 12:34 PM

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.

acdsky July 12th, 2004 05:07 AM

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

madhukp July 12th, 2004 05:23 AM

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.

qazi_nomi July 12th, 2004 05:31 AM

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 !

happygv July 12th, 2004 10:18 AM

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

acdsky July 13th, 2004 01:55 AM

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

rptasiuk July 18th, 2004 07:30 PM

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.

bryant89 November 29th, 2004 04:19 PM

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


aperezgzlz August 29th, 2010 07:03 PM

Quote:

Originally Posted by acdsky (Post 10566)
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



=)


All times are GMT -4. The time now is 06:40 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.