open a new window from within another new browser window

Hi all,

I am using the code below that open a new browser window

Response.Write("<script> ('" + varReportURL + "','_new', 'width=1200,height=600');</script>")

what I want it that I want to open another PDF link from this new browser window. when I am using this same code , its open the pdf in this same browser instead of opening a new window.

please help

Who is Participating?
Bob LearnedConnect With a Mentor Commented:
Change this:

Response.Write("(<script>'" + varReportURL + "','_new', 'width=1000,height=600');</script>")

   to this:

Response.Write("(<script>'" + varReportURL + "','', 'width=1000,height=600');</script>")

That will remove the window name argument, and always open the window in a new browser window.

Bob LearnedCommented:
You might be able to use the target attribute:

Open a link in a new browser window

sanjaypandeyAuthor Commented:
yes, but the problem is I need to do this  based on a button click......  I generate a report url .
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Bob LearnedCommented:
If you are attaching this to a button, then don't use Response.Write, add to the onClick attribute:

Me.Button1.Attributes("onClick") = "javascript:

Also, leave the window name blank to get a new window, instead of reusing an existing window with the same name.

sanjaypandeyAuthor Commented:
I see what you are saying but then I need to execute some code on button click.. that except the parameter from the user... generate report on the server and then the generated url is what I need to open in a new window.

Dim varP1, varP2, varP3 As String
        Dim varModelName As String
        Dim varReportURL As String
        Dim varPARAMETERS As String
        Dim j As Integer
        Dim i As Integer
        j = 0
        varP1 = ""
        varP2 = ""
        varP3 = ""
        For i = 0 To (lstboxProposal.Items.Count - 1)
            If lstboxProposal.Items(i).Selected = True Then
                j = j + 1
                If j = 1 Then
                    varP1 = lstboxProposal.SelectedItem.Text
                ElseIf j = 2 Then
                    varP2 = lstboxProposal.SelectedItem.Text
                ElseIf j = 3 Then
                    varP3 = lstboxProposal.SelectedItem.Text
                End If
            End If
        varModelName = Session("SelectedTblName")
        varPARAMETERS = "P1=" & varP1 & "&P2=" & varP2 & "&P3=" & varP3 & "&ModelName=" & varModelName
 varReportURL = "http://maroa/acweb/maroa/StrategicPolicyAnalysis/PPM.rox?Submit&__scheduleType=sync&__overwrite=new&" & Server.UrlEncode(varPARAMETERS)
        Response.Write("(<script>'" + varReportURL + "','_new', 'width=1000,height=600');</script>")

Open in new window

sanjaypandeyAuthor Commented:
Thanks , that did the trick
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.