Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a new window from asp

Status
Not open for further replies.

avivit

Technical User
Jul 5, 2000
456
IL
Hi,

I'd like to redirect from a certain page, to an external page(an external site), with certain parameters. of that window.

There is nothing to do if using response.redirct,
but is there another option?

For example, I would like to open a new window, that will have a cerain dimensions, and that the url of that window is...
In javascript it is not a problem of course.
What shall I do in asp???
 
you could response.redirect to an ASP page on your site that could then execute the necessary javascript to open the new window.

Response.Redirect "mypage.asp?newwindow=true"

and then in mypage.asp...
Code:
<HTML>
<HEAD>

<% If Request.QueryString("newwindow") <> "" Then %>
<SCRIPT LANGUAGE="JAVASCRIPT">
window.open('[URL unfurl="true"]http://www.mewurl.com','MyNewWindow','top=0,[/URL] left=0, width=600, height=400, etc...')
</SCRIPT>
<% End If %>

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
That's a good idea.

Is it also possible to use response.write for opening a new window in javascript?

I have a function in javascript that can open that window.
But how can I use a response.write to get to this function,
without a trigger?
 
do you mean like this?
Code:
<% 
If Request.QueryString("newwindow") <> "" Then
  Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>" & vbcrlf & _
                 "window.open('[URL unfurl="true"]http://www.abc.com','MyNewWindow',window[/URL] settings here)" & vbcrlf & _
                 "</SCRIPT>" & vbcrlf
End If 
%>
or to call your javascript function...
Code:
<% 
If Request.QueryString("newwindow") <> "" Then
  Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>" & vbcrlf & _
                 "YourFunction();" & vbcrlf & _
                 "</SCRIPT>" & vbcrlf
End If 
%>
What determines when the user is sent to this new site in this new window? Do they have to click anything or is it determined by something else?


Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
I now recalled that one can use:

if xx = "blabla" then

%>
<script language = JavaScript>
functionName();
</script>
<%

End if

But I like your idea very much.
This is totally new to me.
I never thought to leave it all inside the asp tags.

Great idea.
Thanks very much...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top