Posts Tagged ‘’

Open Application in Fullscreen using javascript

December 10, 2009 1 comment

Sometimes, we may have a requirement to open the 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 and its fullscreen properties to open home page as follows:

StringBuilder popupScript = new StringBuilder();

popupScript.Append(“<script language=’JavaScript’> = ‘windowname’;open(”, ‘windowname’); window.close();‘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 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?


Open a New Window On Server Side using Javascript Code in

October 24, 2009 1 comment

Normally to open a new window using javascript we write the following code:

// open new window with specified path

function OpenWindow(url)

    newwindow =, 'mywindow', 'width=500,height=400');  


Now In .aspx.cs page or server side to use the javascript window open you have to use the following code

 StringBuilder popupScript = new StringBuilder();
 popupScript.Append("<script language='JavaScript'>'ViewReports.aspx?groupid=" + ddlreportGroup.SelectedValue.ToString() + "&FromDate=" + Convert.ToDateTime(txtDate.Text) + "&Todate=" + Convert.ToDateTime(txtToDate.Text) + "&Report=Rptname" + "', '', 'width=950, height=580,scrollbars,status,menubar=no,resizable,toolbar=no,titlebar=no,location=no');</script>");
// if you are using script manager - update panel then this
 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "PopupScript", popupScript.ToString(), false);
Page.RegisterStartupScript("PopupScript", popupScript.ToString());