Start the browser without toolbars (workaround)

Rate It (1)

Last post 12-14-2009 5:05 PM by Timeslice. 4 replies.

Sort Posts:

  • Start the browser without toolbars (workaround)

    08-02-2009, 12:38 PM
    • Member
      3 point Member
    • Vournelis
    • Member since 05-10-2009, 5:31 PM
    • Posts 6

     Hello everybody, after spending the better part of the day yesterday searching through the forums I believe I put together a solution for starting your ASP.NET application without the address bar, toolbars, etc.

    There are many discussions about this in forums.asp.net but i could not find one that would give a clear answer so I decided to write this post and maybe I can save some time for the next person looking for this solution.

    The problem: I cannot adjust the browser to hide the toolbar, menubar, address bar... when it is launched by the user and I desperately need the vertical space while all the browser add ons are useless for my application.

    Solution: Create a splash screen (a new web form) and enter the folowing script in the "Load_Complete" event sub.

    ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "Script", "<script language='javascript'>NewWin=window.open('UserLogin.aspx',null,'width=' + screen.width + ', height=' + screen.height + ', top=0, left=0, resizable=yes,menubar=no,toolbar=no,location=no,directories=no,status=no');window.open('','_self','');setTimeout('self.close();',5000);</script>", False)

    Note: Where 'UserLogin.aspx' you should type the name of the form that you wish to have as startup form. You can also adjust the duration that the splash screen will stay on by changing the value in the setTimeout function. I think '5000' will do 5 seconds.

    Now set the splash screen as your startup form and run it.

    In this examble the browser will start with all the toolbars showing and it will display your splash screen. In the mean time it will open a new window without the toolbars and after waiting 5 seconds, it will close the window that the user launched (splash screen).

    The problem was that without the statement window.open('','_self','');, Internet Explorer will prompt the user to confirm that the instance he/she launched is going to close.

    This statement makes Internet Explorer think that the instance was launched through code and it closes without a message.

    I would like to give credit to the programmer that posted the above statement on a forum but I went through so many forums that I could not find that post again. My apologies to the programmer. 

    John V.
  • Re: Start the browser without toolbars (workaround)

    10-14-2009, 11:47 AM
    • Member
      2 point Member
    • ktkrdl
    • Member since 10-14-2009, 3:45 PM
    • Posts 1

    You are my hero!!!   This solution worked great!  Thanks for posting it. 

  • Re: Start the browser without toolbars (workaround)

    11-07-2009, 2:22 AM
    • Member
      100 point Member
    • koushik.dhar
    • Member since 10-12-2009, 12:55 PM
    • Bangalore
    • Posts 36

    Thanks.

    "Please Mark as Answer if it helped you."

    Koushik Dhar
    Software Consultant
    Indika Solutions
    Visit us at www.indikasolutions.com
  • Re: Start the browser without toolbars (workaround)

    11-18-2009, 11:06 PM
    • Member
      2 point Member
    • Spencer0
    • Member since 11-19-2009, 3:59 AM
    • Posts 1

    Thanks for the solution. It really worked. You are my hero man!!

    Muscle Might


  • Re: Start the browser without toolbars (workaround)

    12-14-2009, 5:05 PM
    • Member
      2 point Member
    • Timeslice
    • Member since 12-14-2009, 5:04 PM
    • Posts 1

    Works great in IE8 (and possibly IE7), however not in IE6.

    Anyone tested this in IE7?

    Any alternative that works in IE6?

     

Page 1 of 1 (5 items)