Monday, October 26, 2009

Browser Functionality of Function Key

The different ways of displaying full screen browser window.

1. Using javascript

a.

window.moveTo(0,0);

window.resizeTo(screen.availWidth, screen.availHeight);

b.

window.opener=self;
window.open('index2.htm','','fullscreen=yes');
window.close();

2. Using activex object.

var obj = new ActiveXObject("Shell.Application");

obj.SendKeys("{f11}");

OR

var obj = new ActiveXObject("Wscript.shell");
obj.SendKeys("{f11}");

Note:
·
Using JavaScript:
solution(1.a) doesn’t work with master pages

solution(1.b) works but opens a new window (closing the old window).
· Using actvex objects is not advisable because the user should allow activex objects to run in the browser.

So the simplest solution is using C#.

<asp:TextBox runat="server" ID="txtFunctionalKey"></asp:TextBox>

<asp:Button ID="btnFunctionalityFunctionalKey" runat="Server"
Text="Functional Key"
ToolTip="Click to view Functionality of Functional Key" OnClick="btnFunctionalityFunctionalKey_Click" />

protected void btnFunctionalityFunctionalKey_Click(object sender, EventArgs e)

{

//System.Windows.Forms.SendKeys.SendWait("{F11}");

System.Windows.Forms.SendKeys.SendWait("{" + txtFunctionalKey.Text.Trim() + "}");

}

1 comment:

  1. Wonderful !! This helped me immensely ! Thanks a tons.. I was searching for this exactly.. Works on all browsers too !!

    ReplyDelete