开发者

Editing HTML code on window open

开发者 https://www.devze.com 2023-03-29 07:28 出处:网络
What I need开发者_如何转开发 isin a window I want to open, there is this: width=\"989\" height=\"560\"

What I need开发者_如何转开发 is in a window I want to open, there is this:

width="989" height="560"

And I want the width and height to be that of the screen.


I take it you mean that the HTML of a web page you want to open contains a fixed width and height (indicated in your code snippet above).

Since the server doesn't know where the client's browser is on the screen, nor the size of the screen, it cannot specify the size of the page. Instead, you need to use Javascript to set the size and position of the browser window:

<html>
<head>
    <title>Maximuizing Window</title>
</head>
<body width="300" height="200">
    <h1>Hello world</h1>    
    <p>
        This page should maximize ... but only if its opened alone
        and not as part of browser window containing other open tabs.
    </p>

<script type="text/javascript">
    // When we move the window, make sure to take into consideration the 
    // available screen height to acommodate the taskbar.
    window.moveTo(screen.width - screen.availWidth, screen.height - screen.availHeight);

    // Resize the browser window to the available width & height:
    window.resizeTo(screen.availWidth, screen.availWidth);
</script>
</body>
</html>

HTH.

0

精彩评论

暂无评论...
验证码 换一张
取 消