Home > Asp.net, Javascript > Open Asp.net Application in Fullscreen using javascript

Open Asp.net Application in Fullscreen using javascript


Sometimes, we may have a requirement to open the asp.net application developed, to be opened in full screen mode. To accomplish this, below is the code, in login page, after verifying credentials we redirect user to home page.

So now using javascript, we have to use window.open and its fullscreen properties to open home page as follows:

StringBuilder popupScript = new StringBuilder();

popupScript.Append(“<script language=’JavaScript’> window.name = ‘windowname’;open(”, ‘windowname’); window.close();window.open(‘home.aspx’, ”, ‘fullscreen=yes,status=yes,scrollbars=yes,titlebar=no,addressbar=no’);</script>”);

ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), “PopupScript”, popupScript.ToString(), false);

On Logout, you can write the same script with fullscreen = no

Above code will also bypass the alert message we are getting when redirecting to another page using window.open in javascript.

It will by pass the message prompted

“The Web page you are viewing is trying to close the window” Do you want to close this window?


Advertisements
  1. Ram Chapagain
    November 30, 2011 at 9:12 am

    Thank You very much…very good post.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: