Keystroke working in IE not in Firefox
I am just trying a simple application, to make the browser fullscreen. this is working for Internet Explorer, but not for firefox. Also I want to know, that can the same thing be done in Mac OC? do i have to make changes for Mac OS (using safari, firefox etc)
the code it below.
<html>
<head>
<script type="text/javascript">
function fullScreen()
{
var obj = new ActiveXObject("Wscript.shell");
obj.SendKeys("{F11}");
}
</script>
</head&开发者_如何转开发gt;
<body>
<form>
<input type="button" value="Click me!" onclick="fullScreen()" />
</form>
<p>By pressing the button above, a function will be called. The function will alert a message.</p>
</body>
</html>
Regards Zeeshan
All modern browsers, including IE8, allow the user to disallow a script's opening, moving or resizing a window. Also, IE allows you to prohibit activeX from untrusted (internet) sites, and the other browsers don't have native activeX. so your solution may have very few successes, and a lot of errors and security warnings.
Of course, users can press f-11 anytime- maybe you could suggest they do so.
I believe ActiveXObject
is IE specific so it will never work on FF.
精彩评论