Log in

View Full Version : Browser Window resolution/size define buttons



thisoldhaunt
09-11-2007, 02:32 PM
Hi,

I was wondering if there is a way to have buttons/links on my web site that allows the user to manually select how large the browser window is on his/her monitor.

I want users to be able to select from either 1024 x 768 or 1280 x 1024. The reason for this is that my site looks good at these window sizes/resolutions. With wide screen monitors now pages on my site can get distorted/stretched easily. Someday I wll hire a pro to redesign the site but until then, I will live with what I have.

Here is a simple script that defaults the browser window to 1024 x 768. The problem is that I want the user to be able to select what size window they want and have all pages show up that size. This assumes that the person does not adjust the size after selecting the window size command from my site.


<script language="JavaScript" type="text/JavaScript">
<!--
if(window.resizeTo) self.resizeTo(1024,768);
//-->
</script>

Thanks

boogyman
09-11-2007, 02:56 PM
place in <head> tag


<script type="text/javascript">
function resizeBrowser(w,h)
{
window.resizeTo(w,h)
}
</script>


place where ever you wish to resize and just change the values


<h2>Screen Resolution</h2>
<a href="resizeBrowser(800, 600)">800x600</a>
<a href="resizeBrowser(1024, 800)">1024x760</a>
<a href="resizeBrowser(1280,1024)">1280x1024</a>

I would note though that you will need to adjust the widths so that the user will not have to horizontal scroll

and also, not everyone is going ot have a large screen resolution. so you want to be sure that your site doesnt "break" for someone on a lesser screen resolution, such as 800x600 - which there are plenty of people still using.

thisoldhaunt
09-11-2007, 03:32 PM
Hi,

You make a great point regarding the breaking of lower resolutions 800 x 600. This is why I had hoped to be able to have multiple buttons displayed on every page.

If someone found a page in my site via search engine all 3 buttons would be available no matter what page was called.

800 x 600
1024 x 768
1280 x 1024

once selected the browser window becomes the proper size. Then it will stay that size unless the person manually drags the window to a different size.

Can a button or link selection be made to do the browser resizing? This way the user chooses what resolution they want the window to display at.

Thanks

boogyman
09-11-2007, 03:43 PM
<h2>Screen Resolution</h2>
<a href="resizeBrowser(800, 600)">800x600</a>
<a href="resizeBrowser(1024, 800)">1024x760</a>
<a href="resizeBrowser(1280,1024)">1280x1024</a>

those are links??
are you talking about a dropdown menu?


<h2>Screen Resolution</h2>
<select onchange="resizeBrowser(this.selectedIndex)">
<option value="800,600">800x600</option>
<option value="1024,800">1024x800</option>
<option value="1280,1024">1280x1024</option>
</select>


or buttons


<input type="button" name="browser" value="800x600" onclick=resizeBrowser(800,600)">
<input type="button" name="browser" value="1024x800" onclick=resizeBrowser(1024,800)">
<input type="button" name="browser" value="1280x1024" onclick=resizeBrowser(1280,1024)">

thisoldhaunt
09-11-2007, 03:52 PM
Hi,

I am a newbie at all of this and not much of a programmer at all. More cut & paste and figure out what I did wrong to make it work.

I will play with what you have been kind enough to show me. I am sure I can figure it out once I see how it reacts.

Thanks

thisoldhaunt
09-13-2007, 01:04 AM
Hi,

I cannot get this to work...

I keep getting this error message

firefox can't find the file at /D:/HPS/09-10-2007/resizeBrowser(1024, 800)

Any idea what this means.

Thanks

Ron

thisoldhaunt
09-13-2007, 12:01 PM
Hi,

This is how I got the text links to work....

header

<script type="text/javascript">
function resizeBrowser(w,h)
{
window.resizeTo(w,h)
}
</script>



where ever you want to be displayed

<h2>Screen Resolution</h2>
<a href="javascript:resizeBrowser(800, 600)">800x600</a>
<a href="javascript:resizeBrowser(1024, 760)">1024x760</a>
<a href="javascript:resizeBrowser(1280,1024)">1280x1024</a>


Thanks for all the help, I appreciate it.