Window.Open / Window.Close question

Discussion in 'ASP .Net' started by Dave, Jul 11, 2006.

  1. Dave

    Dave Guest

    For some reason, the below lines only work on select machines. All
    machines are running IE6. IE SP's and OS's vary. When it doesn't
    work, default.aspx (the page that this code is in) opens and closes.
    That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    what's going on here.

    Response.Write("<script
    language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")

    Response.Write("<script language=javascript>window.opener =
    self</script>")
    Response.Write("<script language=javascript>window.close()</script>")
     
    Dave, Jul 11, 2006
    #1
    1. Advertising

  2. Dave

    John Prado Guest

    Dave wrote:
    > For some reason, the below lines only work on select machines. All
    > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > work, default.aspx (the page that this code is in) opens and closes.
    > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > what's going on here.
    >
    > Response.Write("<script
    > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    >
    > Response.Write("<script language=javascript>window.opener =
    > self</script>")
    > Response.Write("<script language=javascript>window.close()</script>")
    >


    Your code will fit best if you do:

    Put the lines below in a string:

    ---------------------------------
    function OpenWin(){ var win =
    window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    window.opener = win;
    self.close();
    }

    window.onload = OpenWin;
    ---------------------------------

    In your PageLoad do
    ---------------------------------
    Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    ---------------------------------

    I'm not sure if this kind of script is a good practice in developing
    web, I thought that is a weird action to user

    :eek:pen a browser wndow:shows another one:closes the opener window

    Some situations like yours could easily be fired by this piece of mess
    up with window pointers.
     
    John Prado, Jul 11, 2006
    #2
    1. Advertising

  3. Dave

    Dave Guest

    John,
    Thanks for your quick reply, but now I'm even more lost than before.
    This is how I interprit your instructions:

    <head runat="server">
    <title>Untitled Page</title>

    <script language="C#" runat="server">

    String scriptString = "function OpenWin() ";
    scriptString += "{ ";
    scriptString += "var win =
    window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    ";
    scriptString += "window.opener = win; ";
    scriptString += "self.close(); ";
    scriptString += "} ";
    scriptString += "window.onload = OpenWin; ";

    </SCRIPT>

    </head>

    This is just full of red squiggly red lines.

    You also say:

    > In your PageLoad do
    > ---------------------------------
    > Page.RegisterStartupScritps(Me.Type, [StringScript], True)




    I'm assuming that you're refering to add it to:

    protected void Page_Load(object sender, EventArgs e)
    {

    }



    I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    This method is now obsolete. I checked because it also had a red
    squggly red line under it.

    I'm really hoping that you give me a quick responce like yesterday.

















    John Prado wrote:
    > Dave wrote:
    > > For some reason, the below lines only work on select machines. All
    > > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > > work, default.aspx (the page that this code is in) opens and closes.
    > > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > > what's going on here.
    > >
    > > Response.Write("<script
    > > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > >
    > > Response.Write("<script language=javascript>window.opener =
    > > self</script>")
    > > Response.Write("<script language=javascript>window.close()</script>")
    > >

    >
    > Your code will fit best if you do:
    >
    > Put the lines below in a string:
    >
    > ---------------------------------
    > function OpenWin(){ var win =
    > window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    > window.opener = win;
    > self.close();
    > }
    >
    > window.onload = OpenWin;
    > ---------------------------------
    >
    > In your PageLoad do
    > ---------------------------------
    > Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > ---------------------------------
    >
    > I'm not sure if this kind of script is a good practice in developing
    > web, I thought that is a weird action to user
    >
    > :eek:pen a browser wndow:shows another one:closes the opener window
    >
    > Some situations like yours could easily be fired by this piece of mess
    > up with window pointers.
     
    Dave, Jul 12, 2006
    #3
  4. Have you checked for popup blockers ?

    Dave wrote:
    > For some reason, the below lines only work on select machines. All
    > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > work, default.aspx (the page that this code is in) opens and closes.
    > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > what's going on here.
    >
    > Response.Write("<script
    > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    >
    > Response.Write("<script language=javascript>window.opener =
    > self</script>")
    > Response.Write("<script language=javascript>window.close()</script>")
     
    Tasos Vogiatzoglou, Jul 12, 2006
    #4
  5. Dave

    Dave Guest

    Yes. It works fine on my machine and I not only use the Windows Popup
    blocker with SP2, but I also use another that comes with a 3rd party
    appication. It doesn't work on various others machines.




    Tasos Vogiatzoglou wrote:
    > Have you checked for popup blockers ?
    >
    > Dave wrote:
    > > For some reason, the below lines only work on select machines. All
    > > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > > work, default.aspx (the page that this code is in) opens and closes.
    > > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > > what's going on here.
    > >
    > > Response.Write("<script
    > > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > >
    > > Response.Write("<script language=javascript>window.opener =
    > > self</script>")
    > > Response.Write("<script language=javascript>window.close()</script>")
     
    Dave, Jul 12, 2006
    #5
  6. Dave

    John Prado Guest

    In .NET 2.0:

    protected void Page_Load(object sender, EventArgs e)
    {
    Page.ClientScript.RegisterStartupScritp(...)
    }


    Dave wrote:
    > John,
    > Thanks for your quick reply, but now I'm even more lost than before.
    > This is how I interprit your instructions:
    >
    > <head runat="server">
    > <title>Untitled Page</title>
    >
    > <script language="C#" runat="server">
    >
    > String scriptString = "function OpenWin() ";
    > scriptString += "{ ";
    > scriptString += "var win =
    > window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    > ";
    > scriptString += "window.opener = win; ";
    > scriptString += "self.close(); ";
    > scriptString += "} ";
    > scriptString += "window.onload = OpenWin; ";
    >
    > </SCRIPT>
    >
    > </head>
    >
    > This is just full of red squiggly red lines.
    >
    > You also say:
    >
    >> In your PageLoad do
    >> ---------------------------------
    >> Page.RegisterStartupScritps(Me.Type, [StringScript], True)

    >
    >
    >
    > I'm assuming that you're refering to add it to:
    >




    >
    >
    > I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    > This method is now obsolete. I checked because it also had a red
    > squggly red line under it.
    >
    > I'm really hoping that you give me a quick responce like yesterday.
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > John Prado wrote:
    >> Dave wrote:
    >>> For some reason, the below lines only work on select machines. All
    >>> machines are running IE6. IE SP's and OS's vary. When it doesn't
    >>> work, default.aspx (the page that this code is in) opens and closes.
    >>> That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    >>> what's going on here.
    >>>
    >>> Response.Write("<script
    >>> language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    >>>
    >>> Response.Write("<script language=javascript>window.opener =
    >>> self</script>")
    >>> Response.Write("<script language=javascript>window.close()</script>")
    >>>

    >> Your code will fit best if you do:
    >>
    >> Put the lines below in a string:
    >>
    >> ---------------------------------
    >> function OpenWin(){ var win =
    >> window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    >> window.opener = win;
    >> self.close();
    >> }
    >>
    >> window.onload = OpenWin;
    >> ---------------------------------
    >>
    >> In your PageLoad do
    >> ---------------------------------
    >> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    >> ---------------------------------
    >>
    >> I'm not sure if this kind of script is a good practice in developing
    >> web, I thought that is a weird action to user
    >>
    >> :eek:pen a browser wndow:shows another one:closes the opener window
    >>
    >> Some situations like yours could easily be fired by this piece of mess
    >> up with window pointers.

    >
     
    John Prado, Jul 12, 2006
    #6
  7. Dave

    Dave Guest

    Thanks Again John for a quick reply. Please keep in mind that I'm
    using exactly what you're showing me. If something is in
    Brackets...I'm putting Brackets in there as well.


    This is what I have:


    protected void Page_Load(object sender, EventArgs e)
    {
    Page.RegisterStartupScripts(Me.Type, [StringScript], True);

    }

    Below are the comments:

    RegisterStartupScripts = (Blue line) - System.Web.UI.Page does not
    contain a definition for 'RegisterStartupScripts'.
    Me = (Blue Line) - The name 'ME' does not exist in the current context.
    [StringScript] = (Redline) - ) expected
    True = (Redline) - ; expected


    On the HTML Page:

    <head runat="server">
    <title>Untitled Page</title>

    Function OpenWin()
    {
    var
    win=window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no"
    window.opener = win;
    self.close();
    }

    window.Onload = OpenWin;
    </head>














    John Prado wrote:
    > In .NET 2.0:
    >
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > Page.ClientScript.RegisterStartupScritp(...)
    > }
    >
    >
    > Dave wrote:
    > > John,
    > > Thanks for your quick reply, but now I'm even more lost than before.
    > > This is how I interprit your instructions:
    > >
    > > <head runat="server">
    > > <title>Untitled Page</title>
    > >
    > > <script language="C#" runat="server">
    > >
    > > String scriptString = "function OpenWin() ";
    > > scriptString += "{ ";
    > > scriptString += "var win =
    > > window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    > > ";
    > > scriptString += "window.opener = win; ";
    > > scriptString += "self.close(); ";
    > > scriptString += "} ";
    > > scriptString += "window.onload = OpenWin; ";
    > >
    > > </SCRIPT>
    > >
    > > </head>
    > >
    > > This is just full of red squiggly red lines.
    > >
    > > You also say:
    > >
    > >> In your PageLoad do
    > >> ---------------------------------
    > >> Page.RegisterStartupScritps(Me.Type, [StringScript], True)

    > >
    > >
    > >
    > > I'm assuming that you're refering to add it to:
    > >

    >
    >
    >
    > >
    > >
    > > I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    > > This method is now obsolete. I checked because it also had a red
    > > squggly red line under it.
    > >
    > > I'm really hoping that you give me a quick responce like yesterday.
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > John Prado wrote:
    > >> Dave wrote:
    > >>> For some reason, the below lines only work on select machines. All
    > >>> machines are running IE6. IE SP's and OS's vary. When it doesn't
    > >>> work, default.aspx (the page that this code is in) opens and closes.
    > >>> That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > >>> what's going on here.
    > >>>
    > >>> Response.Write("<script
    > >>> language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > >>>
    > >>> Response.Write("<script language=javascript>window.opener =
    > >>> self</script>")
    > >>> Response.Write("<script language=javascript>window.close()</script>")
    > >>>
    > >> Your code will fit best if you do:
    > >>
    > >> Put the lines below in a string:
    > >>
    > >> ---------------------------------
    > >> function OpenWin(){ var win =
    > >> window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    > >> window.opener = win;
    > >> self.close();
    > >> }
    > >>
    > >> window.onload = OpenWin;
    > >> ---------------------------------
    > >>
    > >> In your PageLoad do
    > >> ---------------------------------
    > >> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > >> ---------------------------------
    > >>
    > >> I'm not sure if this kind of script is a good practice in developing
    > >> web, I thought that is a weird action to user
    > >>
    > >> :eek:pen a browser wndow:shows another one:closes the opener window
    > >>
    > >> Some situations like yours could easily be fired by this piece of mess
    > >> up with window pointers.

    > >
     
    Dave, Jul 12, 2006
    #7
  8. Dave

    John Prado Guest

    The correct call to RegisterStartupScript in .net 2.0 is:

    Page.ClientScript.RegisterStartupScript(...)

    Two things
    1. I mistyped the end of the function, it has an "S" that not supose to
    be at the end of the call.
    2. Remove the brackets "[...]" from your call

    Dude, take a look at C# sintax. Without know the basics you will suffer
    a lot.

    Good luck


    Dave wrote:
    > Thanks Again John for a quick reply. Please keep in mind that I'm
    > using exactly what you're showing me. If something is in
    > Brackets...I'm putting Brackets in there as well.
    >
    >
    > This is what I have:
    >
    >
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > Page.RegisterStartupScripts(Me.Type, [StringScript], True);
    >
    > }
    >
    > Below are the comments:
    >
    > RegisterStartupScripts = (Blue line) - System.Web.UI.Page does not
    > contain a definition for 'RegisterStartupScripts'.
    > Me = (Blue Line) - The name 'ME' does not exist in the current context.
    > [StringScript] = (Redline) - ) expected
    > True = (Redline) - ; expected
    >
    >
    > On the HTML Page:
    >
    > <head runat="server">
    > <title>Untitled Page</title>
    >
    > Function OpenWin()
    > {
    > var
    > win=window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no"
    > window.opener = win;
    > self.close();
    > }
    >
    > window.Onload = OpenWin;
    > </head>
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > John Prado wrote:
    >> In .NET 2.0:
    >>
    >> protected void Page_Load(object sender, EventArgs e)
    >> {
    >> Page.ClientScript.RegisterStartupScritp(...)
    >> }
    >>
    >>
    >> Dave wrote:
    >>> John,
    >>> Thanks for your quick reply, but now I'm even more lost than before.
    >>> This is how I interprit your instructions:
    >>>
    >>> <head runat="server">
    >>> <title>Untitled Page</title>
    >>>
    >>> <script language="C#" runat="server">
    >>>
    >>> String scriptString = "function OpenWin() ";
    >>> scriptString += "{ ";
    >>> scriptString += "var win =
    >>> window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    >>> ";
    >>> scriptString += "window.opener = win; ";
    >>> scriptString += "self.close(); ";
    >>> scriptString += "} ";
    >>> scriptString += "window.onload = OpenWin; ";
    >>>
    >>> </SCRIPT>
    >>>
    >>> </head>
    >>>
    >>> This is just full of red squiggly red lines.
    >>>
    >>> You also say:
    >>>
    >>>> In your PageLoad do
    >>>> ---------------------------------
    >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    >>>
    >>>
    >>> I'm assuming that you're refering to add it to:
    >>>

    >>
    >>
    >>>
    >>> I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    >>> This method is now obsolete. I checked because it also had a red
    >>> squggly red line under it.
    >>>
    >>> I'm really hoping that you give me a quick responce like yesterday.
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>> John Prado wrote:
    >>>> Dave wrote:
    >>>>> For some reason, the below lines only work on select machines. All
    >>>>> machines are running IE6. IE SP's and OS's vary. When it doesn't
    >>>>> work, default.aspx (the page that this code is in) opens and closes.
    >>>>> That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    >>>>> what's going on here.
    >>>>>
    >>>>> Response.Write("<script
    >>>>> language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    >>>>>
    >>>>> Response.Write("<script language=javascript>window.opener =
    >>>>> self</script>")
    >>>>> Response.Write("<script language=javascript>window.close()</script>")
    >>>>>
    >>>> Your code will fit best if you do:
    >>>>
    >>>> Put the lines below in a string:
    >>>>
    >>>> ---------------------------------
    >>>> function OpenWin(){ var win =
    >>>> window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    >>>> window.opener = win;
    >>>> self.close();
    >>>> }
    >>>>
    >>>> window.onload = OpenWin;
    >>>> ---------------------------------
    >>>>
    >>>> In your PageLoad do
    >>>> ---------------------------------
    >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    >>>> ---------------------------------
    >>>>
    >>>> I'm not sure if this kind of script is a good practice in developing
    >>>> web, I thought that is a weird action to user
    >>>>
    >>>> :eek:pen a browser wndow:shows another one:closes the opener window
    >>>>
    >>>> Some situations like yours could easily be fired by this piece of mess
    >>>> up with window pointers.

    >
     
    John Prado, Jul 12, 2006
    #8
  9. Dave

    Dave Guest

    I'm suffering... :-(



    John Prado wrote:
    > The correct call to RegisterStartupScript in .net 2.0 is:
    >
    > Page.ClientScript.RegisterStartupScript(...)
    >
    > Two things
    > 1. I mistyped the end of the function, it has an "S" that not supose to
    > be at the end of the call.
    > 2. Remove the brackets "[...]" from your call
    >
    > Dude, take a look at C# sintax. Without know the basics you will suffer
    > a lot.
    >
    > Good luck
    >
    >
    > Dave wrote:
    > > Thanks Again John for a quick reply. Please keep in mind that I'm
    > > using exactly what you're showing me. If something is in
    > > Brackets...I'm putting Brackets in there as well.
    > >
    > >
    > > This is what I have:
    > >
    > >
    > > protected void Page_Load(object sender, EventArgs e)
    > > {
    > > Page.RegisterStartupScripts(Me.Type, [StringScript], True);
    > >
    > > }
    > >
    > > Below are the comments:
    > >
    > > RegisterStartupScripts = (Blue line) - System.Web.UI.Page does not
    > > contain a definition for 'RegisterStartupScripts'.
    > > Me = (Blue Line) - The name 'ME' does not exist in the current context.
    > > [StringScript] = (Redline) - ) expected
    > > True = (Redline) - ; expected
    > >
    > >
    > > On the HTML Page:
    > >
    > > <head runat="server">
    > > <title>Untitled Page</title>
    > >
    > > Function OpenWin()
    > > {
    > > var
    > > win=window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no"
    > > window.opener = win;
    > > self.close();
    > > }
    > >
    > > window.Onload = OpenWin;
    > > </head>
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > John Prado wrote:
    > >> In .NET 2.0:
    > >>
    > >> protected void Page_Load(object sender, EventArgs e)
    > >> {
    > >> Page.ClientScript.RegisterStartupScritp(...)
    > >> }
    > >>
    > >>
    > >> Dave wrote:
    > >>> John,
    > >>> Thanks for your quick reply, but now I'm even more lost than before.
    > >>> This is how I interprit your instructions:
    > >>>
    > >>> <head runat="server">
    > >>> <title>Untitled Page</title>
    > >>>
    > >>> <script language="C#" runat="server">
    > >>>
    > >>> String scriptString = "function OpenWin() ";
    > >>> scriptString += "{ ";
    > >>> scriptString += "var win =
    > >>> window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    > >>> ";
    > >>> scriptString += "window.opener = win; ";
    > >>> scriptString += "self.close(); ";
    > >>> scriptString += "} ";
    > >>> scriptString += "window.onload = OpenWin; ";
    > >>>
    > >>> </SCRIPT>
    > >>>
    > >>> </head>
    > >>>
    > >>> This is just full of red squiggly red lines.
    > >>>
    > >>> You also say:
    > >>>
    > >>>> In your PageLoad do
    > >>>> ---------------------------------
    > >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > >>>
    > >>>
    > >>> I'm assuming that you're refering to add it to:
    > >>>
    > >>
    > >>
    > >>>
    > >>> I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    > >>> This method is now obsolete. I checked because it also had a red
    > >>> squggly red line under it.
    > >>>
    > >>> I'm really hoping that you give me a quick responce like yesterday.
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>> John Prado wrote:
    > >>>> Dave wrote:
    > >>>>> For some reason, the below lines only work on select machines. All
    > >>>>> machines are running IE6. IE SP's and OS's vary. When it doesn't
    > >>>>> work, default.aspx (the page that this code is in) opens and closes.
    > >>>>> That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > >>>>> what's going on here.
    > >>>>>
    > >>>>> Response.Write("<script
    > >>>>> language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > >>>>>
    > >>>>> Response.Write("<script language=javascript>window.opener =
    > >>>>> self</script>")
    > >>>>> Response.Write("<script language=javascript>window.close()</script>")
    > >>>>>
    > >>>> Your code will fit best if you do:
    > >>>>
    > >>>> Put the lines below in a string:
    > >>>>
    > >>>> ---------------------------------
    > >>>> function OpenWin(){ var win =
    > >>>> window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    > >>>> window.opener = win;
    > >>>> self.close();
    > >>>> }
    > >>>>
    > >>>> window.onload = OpenWin;
    > >>>> ---------------------------------
    > >>>>
    > >>>> In your PageLoad do
    > >>>> ---------------------------------
    > >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > >>>> ---------------------------------
    > >>>>
    > >>>> I'm not sure if this kind of script is a good practice in developing
    > >>>> web, I thought that is a weird action to user
    > >>>>
    > >>>> :eek:pen a browser wndow:shows another one:closes the opener window
    > >>>>
    > >>>> Some situations like yours could easily be fired by this piece of mess
    > >>>> up with window pointers.

    > >
     
    Dave, Jul 12, 2006
    #9
  10. Dave

    Dave Guest

    I'm suffering... :-(

    Thanks for your help all the same.




    John Prado wrote:
    > The correct call to RegisterStartupScript in .net 2.0 is:
    >
    > Page.ClientScript.RegisterStartupScript(...)
    >
    > Two things
    > 1. I mistyped the end of the function, it has an "S" that not supose to
    > be at the end of the call.
    > 2. Remove the brackets "[...]" from your call
    >
    > Dude, take a look at C# sintax. Without know the basics you will suffer
    > a lot.
    >
    > Good luck
    >
    >
    > Dave wrote:
    > > Thanks Again John for a quick reply. Please keep in mind that I'm
    > > using exactly what you're showing me. If something is in
    > > Brackets...I'm putting Brackets in there as well.
    > >
    > >
    > > This is what I have:
    > >
    > >
    > > protected void Page_Load(object sender, EventArgs e)
    > > {
    > > Page.RegisterStartupScripts(Me.Type, [StringScript], True);
    > >
    > > }
    > >
    > > Below are the comments:
    > >
    > > RegisterStartupScripts = (Blue line) - System.Web.UI.Page does not
    > > contain a definition for 'RegisterStartupScripts'.
    > > Me = (Blue Line) - The name 'ME' does not exist in the current context.
    > > [StringScript] = (Redline) - ) expected
    > > True = (Redline) - ; expected
    > >
    > >
    > > On the HTML Page:
    > >
    > > <head runat="server">
    > > <title>Untitled Page</title>
    > >
    > > Function OpenWin()
    > > {
    > > var
    > > win=window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no"
    > > window.opener = win;
    > > self.close();
    > > }
    > >
    > > window.Onload = OpenWin;
    > > </head>
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > John Prado wrote:
    > >> In .NET 2.0:
    > >>
    > >> protected void Page_Load(object sender, EventArgs e)
    > >> {
    > >> Page.ClientScript.RegisterStartupScritp(...)
    > >> }
    > >>
    > >>
    > >> Dave wrote:
    > >>> John,
    > >>> Thanks for your quick reply, but now I'm even more lost than before.
    > >>> This is how I interprit your instructions:
    > >>>
    > >>> <head runat="server">
    > >>> <title>Untitled Page</title>
    > >>>
    > >>> <script language="C#" runat="server">
    > >>>
    > >>> String scriptString = "function OpenWin() ";
    > >>> scriptString += "{ ";
    > >>> scriptString += "var win =
    > >>> window.open('TSReminder.aspx',null,'height=340,width=640,status=no,toolbar=­no,menubar=no,location=no');
    > >>> ";
    > >>> scriptString += "window.opener = win; ";
    > >>> scriptString += "self.close(); ";
    > >>> scriptString += "} ";
    > >>> scriptString += "window.onload = OpenWin; ";
    > >>>
    > >>> </SCRIPT>
    > >>>
    > >>> </head>
    > >>>
    > >>> This is just full of red squiggly red lines.
    > >>>
    > >>> You also say:
    > >>>
    > >>>> In your PageLoad do
    > >>>> ---------------------------------
    > >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > >>>
    > >>>
    > >>> I'm assuming that you're refering to add it to:
    > >>>
    > >>
    > >>
    > >>>
    > >>> I also checked Help about Page.RegisterStartupScrips and it says NOTE:
    > >>> This method is now obsolete. I checked because it also had a red
    > >>> squggly red line under it.
    > >>>
    > >>> I'm really hoping that you give me a quick responce like yesterday.
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>
    > >>> John Prado wrote:
    > >>>> Dave wrote:
    > >>>>> For some reason, the below lines only work on select machines. All
    > >>>>> machines are running IE6. IE SP's and OS's vary. When it doesn't
    > >>>>> work, default.aspx (the page that this code is in) opens and closes.
    > >>>>> That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > >>>>> what's going on here.
    > >>>>>
    > >>>>> Response.Write("<script
    > >>>>> language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > >>>>>
    > >>>>> Response.Write("<script language=javascript>window.opener =
    > >>>>> self</script>")
    > >>>>> Response.Write("<script language=javascript>window.close()</script>")
    > >>>>>
    > >>>> Your code will fit best if you do:
    > >>>>
    > >>>> Put the lines below in a string:
    > >>>>
    > >>>> ---------------------------------
    > >>>> function OpenWin(){ var win =
    > >>>> window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no");
    > >>>> window.opener = win;
    > >>>> self.close();
    > >>>> }
    > >>>>
    > >>>> window.onload = OpenWin;
    > >>>> ---------------------------------
    > >>>>
    > >>>> In your PageLoad do
    > >>>> ---------------------------------
    > >>>> Page.RegisterStartupScritps(Me.Type, [StringScript], True)
    > >>>> ---------------------------------
    > >>>>
    > >>>> I'm not sure if this kind of script is a good practice in developing
    > >>>> web, I thought that is a weird action to user
    > >>>>
    > >>>> :eek:pen a browser wndow:shows another one:closes the opener window
    > >>>>
    > >>>> Some situations like yours could easily be fired by this piece of mess
    > >>>> up with window pointers.

    > >
     
    Dave, Jul 12, 2006
    #10
  11. What are the security settings of the domain you try to access from the
    other computers ? I mean, if the software/equipment is the same, it
    must be a configuration issue.

    I would check for security related stuff

    Dave wrote:
    > Yes. It works fine on my machine and I not only use the Windows Popup
    > blocker with SP2, but I also use another that comes with a 3rd party
    > appication. It doesn't work on various others machines.
    >
    >
    >
    >
    > Tasos Vogiatzoglou wrote:
    > > Have you checked for popup blockers ?
    > >
    > > Dave wrote:
    > > > For some reason, the below lines only work on select machines. All
    > > > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > > > work, default.aspx (the page that this code is in) opens and closes.
    > > > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > > > what's going on here.
    > > >
    > > > Response.Write("<script
    > > > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > > >
    > > > Response.Write("<script language=javascript>window.opener =
    > > > self</script>")
    > > > Response.Write("<script language=javascript>window.close()</script>")
     
    Tasos Vogiatzoglou, Jul 13, 2006
    #11
  12. Dave

    Dave Guest

    Maybe whether or not JAVA is able to run in IE? All this page is is a
    reminder to fill out their Timesheet. The original that they use now
    is a Windows Form. It's a pain when you're logging in to the Domain
    from somewhere else in the Country/World because that thing has to be
    dragged across the wire, so I decided to play with a IE popup. It
    loads 10 times faster...when it works.

    If it's a settings issue, then what would be a good suggestion so that
    we don't have to worry about modifying 30k plus machines to ensure that
    it works?



    Tasos Vogiatzoglou wrote:
    > What are the security settings of the domain you try to access from the
    > other computers ? I mean, if the software/equipment is the same, it
    > must be a configuration issue.
    >
    > I would check for security related stuff
    >
    > Dave wrote:
    > > Yes. It works fine on my machine and I not only use the Windows Popup
    > > blocker with SP2, but I also use another that comes with a 3rd party
    > > appication. It doesn't work on various others machines.
    > >
    > >
    > >
    > >
    > > Tasos Vogiatzoglou wrote:
    > > > Have you checked for popup blockers ?
    > > >
    > > > Dave wrote:
    > > > > For some reason, the below lines only work on select machines. All
    > > > > machines are running IE6. IE SP's and OS's vary. When it doesn't
    > > > > work, default.aspx (the page that this code is in) opens and closes.
    > > > > That's all you see. TSReminder.aspx doesn't even open. I'm not sure
    > > > > what's going on here.
    > > > >
    > > > > Response.Write("<script
    > > > > language=javascript>window.open("TSReminder.aspx",null,"height=340,width=640,status=no,toolbar=no,menubar=no,location=no")</script>")
    > > > >
    > > > > Response.Write("<script language=javascript>window.opener =
    > > > > self</script>")
    > > > > Response.Write("<script language=javascript>window.close()</script>")
     
    Dave, Jul 13, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?a2x5bm4=?=

    open window & close prior window

    =?Utf-8?B?a2x5bm4=?=, Oct 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    522
    =?Utf-8?B?a2x5bm4=?=
    Oct 7, 2005
  2. Replies:
    6
    Views:
    8,900
    sateeshranga
    Aug 7, 2008
  3. Iñaki Baz Castillo
    Replies:
    7
    Views:
    918
    Iñaki Baz Castillo
    Jan 12, 2010
  4. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    404
    Gérard Talbot
    Sep 2, 2005
  5. Iulian Ilea
    Replies:
    1
    Views:
    335
    pcx99
    Dec 21, 2006
Loading...

Share This Page