Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am using following html code to resize browser size
HTML
<body onload="window.resizeTo(700,300)">

.it is working in Internet Explorer.
. But why it is not working in FireFox/Chrome?

What should i try for my problem?
Posted
Updated 2-May-13 0:01am
v2

1 solution

Follow the below code.
At the page which you want to resize
C#
<head>
<script type="text/javascript">

    function myFunction() {
        this.resizeTo(500, 500);
    this.focus();
}

</script>


</head>


call this function on onload event.
C#
<body  onload="myFunction();">
 
Share this answer
 
v3
Comments
MuhammadUSman1 2-May-13 6:39am    
Here it is my full html page code. on this i want to use this.
According to your code first i'll open new window then resize that window. But in my code how i use it.


<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Input Error</title>
<style type="text/css">
.auto-style1 {
width: 262px;
}
.auto-style2 {
width: 262px;
color:red;
}
</style>
<script>
var w;
function openwindow()
{
w=window.open('','', 'width=100,height=100');
w.focus();
myFunction();
}

function myFunction()
{
w.resizeTo(500,500);
w.focus();
}

</script>
</head>
<body önload="window.resizeTo(700,300)">
<div>

<table border="1" style="width: 80%; margin-top:15%; top:50%; left:50%; text-align:center;" >
<tbody>
<tr>
<td class="auto-style1">
Error Type
</td>
<td class="auto-style1">
Error Discription
</td>
<td class="auto-style1">
Follow Up
</td>
</tr>
<tr>
<td class="auto-style2">
Input Error
</td>
<td class="auto-style1">
NPI can't be null or empty
</td>
<td>
Please provide valid NPI
</td>
</tr>
</tbody>
</table>

</div>
</body>
</html>
Thanks7872 2-May-13 6:42am    
Even with your code also,its not clear what you going to do. You have simple javascript to open window,or to resize window. You can use it anywhere in your code and with controls.
MuhammadUSman1 2-May-13 6:47am    
Dear! my totally code is this. i don't want to work more on this page. But i want to show this page in size range of (700,300). that's it.
MuhammadUSman1 2-May-13 7:06am    
?
MuhammadUSman1 2-May-13 6:45am    
Dear! Rohan Leuva Please Reply.
thanx for your Quick Reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900