views:

10301

answers:

6

How can I make full screen in JavaScript that works in IE, Firefox and Opera. When I mean full screen I mean one that takes all of your screen

+5  A: 

This is as close as you can get to full screen in javacript:

<script type="text/javascript">
    window.onload = maxWindow;

    function maxWindow() {
        window.moveTo(0, 0);


        if (document.all) {
            top.window.resizeTo(screen.availWidth, screen.availHeight);
        }

        else if (document.layers || document.getElementById) {
            if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
                top.window.outerHeight = screen.availHeight;
                top.window.outerWidth = screen.availWidth;
            }
        }
    }

</script>
Saul Dolgin
not working in firefox 3.5
look at the link/accepted answer in the link haim evgi posted ... you're not supposed to be able to resize the browser. You can however maximize within the browsers window (that how I read it)
lexu
Strange, I just re-tested this script in FF 3.5 and it seemed to work fine... what are we missing?
Saul Dolgin
Depends on your javascript permission settings in Options. You can toggle js control over window features.
garrow
This happened last time a site used code like that and I didn't block it: http://dorward.me.uk/tmp/fullscreen.jpeg
David Dorward
A: 

Luckily for unsuspecting web users this cannot be done with just javascript. You would need to write browser specific plugins, if they didn't already exist, and then somehow get people to download them. The closest you can get is a maximized window with no tool or navigation bars but users will still be able to see the url.

window.open('http://www.web-page.com', 'title' , 'type=fullWindow, fullscreen, scrollbars=yes');">

This is generally considered bad practice though as it removes a lot of browser functionality from the user.

shit a birck
A: 

This may support

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="PRODUCTION_Default5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
        function max()
        {
           window.open("", "_self", "fullscreen=yes, scrollbars=auto"); 
        }
    </script>
</head>
<body onload="max()">
    <form id="form1" runat="server">
    <div>
    This is Test Page
    </div>
    </form>
</body>
</html>
Srinivasan
A: 

how about using flash and a flah<->javascript bridge (the two of them can communicate quite well)? ...though I can't give you an example of how to code this

neuronq
+2  A: 

I've used this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript">
function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}
// End -->
</script>
</head>
<body><h1 style="text-align: center;">
Open In Full Screen
</h1><div style="text-align: center;"><br>
<a href="javascript:void(0);" onclick="fullScreen('http://google.com');"&gt;
Open Full Screen Window
</a>
</div>
</body>
</html>
Jerry Rutherford