locked
How to open a window without address bar? RRS feed

  • Question

  • User1762613338 posted

    Hello ,

    I want to open a new window  without address bar after successfull login.i know the client side javascript for this task that is

     

    function pop( location )

    {

    var winWidth = 400 ;

    var winHeight = 400 ;

    var posLeft = ( screen.width - winWidth ) / 2 ;

    var posTop = ( screen.height - winHeight ) / 2 ;

    myWindow = window.open( location,'mywindow','width=' + winWidth + ',height=' + winHeight +',top=' + posTop + ',left=' + posLeft +

    ',resizable=yes,scrollbars=yes,toolbar=no,titlebar=no,' +

    'location=no,directories=no,status=no,menubar=no,copyhistory=no' ) ;

     

    }

    But Problem is that after clicking login button who check for users in sql database; It is server side code.

    Now i dont know how to Open the next page in a window without address bar??[8-)]

     

    please help.....!

    Wednesday, January 24, 2007 1:47 AM

Answers

  • User1762613338 posted

    please give me the possible solution to achieve this [8-)].......!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 25, 2007 3:34 AM
  • User1762613338 posted

    hello;

    Can i write above mentioned script in page load event of the redirected page.........?

    if yes then please guid me how i can implement it.......!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 25, 2007 3:37 AM
  • User613958134 posted

    I tried this my end and it worked.

    I added your pop() functionto my javascript section in my aspx.  Then, in the server-side Page_Load event, i added the following code

    string myURL = "MyCrazyPage.aspx";
    this.Controls.Add(new LiterControl("<script>javascript:pop(\"" + myURL +"\");"));
    Hope this helps :¬)
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 31, 2007 6:10 AM
  • User613958134 posted

    for crying out loud!!  sometime this forums plays games with my.  I'll start again

     

     protected void Page_Load(object sender, EventArgs e)
     {
         string myURL = "SomePage.aspx";
         this.Controls.Add(new LiteralControl("<script>javascript:pop(\"" + myURL + "\");</script>"));
     }
      


           

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 31, 2007 6:17 AM
  • User1762613338 posted

    thanks Hoonius

     

    You have provided me the perfect solution to my problem. Thank you very much.[Yes][:)]

    please do me a favour, please explain me 2nd line of code.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 2:03 AM
  • User613958134 posted

    the Controls.Add() bit just adds a new LiteralControl to the page.  This can be anything that would normally exist in a web page, in this case it's a little bit of javascript.  since it's just a call to your method, the browser reads the page as normal, then see's this script portion which it will try and execute since it's not in a function construct. The piece we added calls your pop() method, passing in a URL of your choice, and pop() goes on to do it's window.open thing.

    I'm not sure if it's best practise or whatever, but it certainly got me out of a few holes in the past.  You can also close that window from server-side code by issueing a <script>javascript:window.close()</script> literal on a button click or something.  This should work on popups but i think the browser will complain if you try and close the main window like this

    glad to have been of assistance :¬)
     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 4:46 AM

All replies

  • User487807879 posted
    I'm not sure, but I think you can't do that in any way with the latest version of browsers (IE7, FF2..) because they don't support this option for security reasons.
    Wednesday, January 24, 2007 2:30 AM
  • User1762613338 posted

    please give me the possible solution to achieve this [8-)].......!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 25, 2007 3:34 AM
  • User1762613338 posted

    hello;

    Can i write above mentioned script in page load event of the redirected page.........?

    if yes then please guid me how i can implement it.......!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 25, 2007 3:37 AM
  • User613958134 posted

    I tried this my end and it worked.

    I added your pop() functionto my javascript section in my aspx.  Then, in the server-side Page_Load event, i added the following code

    string myURL = "MyCrazyPage.aspx";
    this.Controls.Add(new LiterControl("&lt;script>javascript:pop(\"" + myURL +"\");"));
    Hope this helps :¬)
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 31, 2007 6:10 AM
  • User613958134 posted

    that last code didn;t come out right and this damn forum does not allow you to edit posts

     

    this.Controls.Add(new LiterControl("<script>javascript:pop(\"" + myURL +"\");</script>")); 

    Wednesday, January 31, 2007 6:12 AM
  • User613958134 posted

    That last line didn;t come out right and i can't edit posts here it seems :¬(

     

    this.Controls.Add(new LiteralControl("<script>javascript:pop(\"" + myURL +"\");</script>")); 

    Wednesday, January 31, 2007 6:13 AM
  • User613958134 posted

    for crying out loud!!  sometime this forums plays games with my.  I'll start again

     

     protected void Page_Load(object sender, EventArgs e)
     {
         string myURL = "SomePage.aspx";
         this.Controls.Add(new LiteralControl("<script>javascript:pop(\"" + myURL + "\");</script>"));
     }
      


           

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 31, 2007 6:17 AM
  • User1762613338 posted

    thanks Hoonius

     

    You have provided me the perfect solution to my problem. Thank you very much.[Yes][:)]

    please do me a favour, please explain me 2nd line of code.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 2:03 AM
  • User613958134 posted

    the Controls.Add() bit just adds a new LiteralControl to the page.  This can be anything that would normally exist in a web page, in this case it's a little bit of javascript.  since it's just a call to your method, the browser reads the page as normal, then see's this script portion which it will try and execute since it's not in a function construct. The piece we added calls your pop() method, passing in a URL of your choice, and pop() goes on to do it's window.open thing.

    I'm not sure if it's best practise or whatever, but it certainly got me out of a few holes in the past.  You can also close that window from server-side code by issueing a <script>javascript:window.close()</script> literal on a button click or something.  This should work on popups but i think the browser will complain if you try and close the main window like this

    glad to have been of assistance :¬)
     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 4:46 AM
  • User-1688778083 posted

    Hoonius solution is correct. But you can do it even simpler, without server side code. You simply include in the next page the following HTML/Javascript code:

    <html><head>
    <script>javascript:pop("someURL");</script>
    </head>
     ...
    </html>
    
    This does preety much the same, but without server side code. If the nest url is not known in advance (you have to execute some server side logic to know it) you can do it like this:
     
    <html><head>
    <script>javascript:pop("<%=GetNextUrl()%>");</script>
    </head>
     ...
    </html>
    

    GetNextUrl() is some serve side mthod that returns a string with the next URL.

     
    Hope this helps. 

     

     

    Saturday, February 3, 2007 6:36 PM