-
Senior Member
Detecting screen size in IE...
I'm creating a website at the moment and it all looks very nice in 1024x768, problem is if they use 800x600 the pictures are too big and the site doesn't look right at all.
Is there any way I can detect the resolution and load smaller pictures/resize the pictures if they're using 800x600?
Thanks
-
Senior Member
When I first tried my hand at creating web pages a number of years ago I asked a similar question.....
What I've personally found is that you should design your site around the fact that some users are going to have users that are running 800x600 and I haven't really found a real reason to make your site more than 800 pixels wide....I understand that doesn't answer your question...the answer to your question would be to find a javascript script that detects the size:
Code:
<SCRIPT language="JavaScript">
<!--
if ((screen.width>=1024) && (screen.height>=768))
{
window.location="highres.html";
}
else
{
window.location="lowres.html";
}
//-->
</SCRIPT>
IMO it's bad design, but thats me.
Live by it: RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove
-
Ultimate Member
CompGeek is right there, you should make your site for the lowest common denominator, it used to be 640*480, but 800*600 is a very safe bet now-a-days (make sure you leave enough space for scrollbars so go for 780 width max).
The other option if you have a dynamic site is to make several views for the same info to make sure you take into account all the different browsers/window sizes...
IMO, simply go to the lowest/slowest computer and make a website which is suitable for them, too many sites now-a-days think everyone is on broadband so load up the pages with horrible and uncessary flash pages which just slow the whole thing down. I have 512adsl at home and some pages take an age to load... the only pages that are acceptable in that arena are ones I want to see such as movies, or pictures, not products I want to find some information about!
-
Senior Member
I understand what you're saying, and I've tried to design the site partly with that in mind.
But my problem is specifically with the pictures. They're not very big at the moment (ie 300x250 pixels) but obviously in 800x600 they're huge.
But... if I just make them smaller then it won't look right for 1024x768 users.
That's why I was looking for some test to say:
if its 1024x768 then <img bigpicture.jpg> if its 800x600 then <img smallpicture.jpg>
-
Member
One thing you could try is to set the width property inside your IMG tag to be a percentage (% of available room).
If you have your pictures constrained to a table, then the table will change size when the window changes size, and thus also will your pictures change proportionately.
This really isnt the best way to go about this, but it is a way, and it does work.
"Study the past if you would define the future." - Confucius
-
Senior Member
I tried that, but I think the width tag is related to the original image size, not the size of the table/window.
ie I put in Width="30%" but it just made the picture 1/3 the size not 1/3 of the window size.
-
Senior Member
Have you tried implementing the code I provided?
Live by it: RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove
-
Senior Member
-
Senior Member
You could either create seperate pages (like the example) or have a script that would set each image on the page to small or big...I'm not sure how you would do the latter..because I'm not very proficient in javascript.
I'm sure someone else could help you if you needed the other. Good luck!
Live by it: RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove
-
Senior Member
Thanks, that script worked a treat!
I've now got to resize all the images though, bugger
I'm glad its not that big a site, only about 10 pages
-
Senior Member
It actually didn't take me very long at all, I'm very impressed it works so easily!
I've got 2 index files, index.html (hires) and index_lowres.html. At the top of each there's a script that says "if this isn't the right file for the resolution, load the other one.
Works very well! Check it out:
http://www.santoshighamfarm.co.uk
I'm happy to hear comments, its not yet finished
-
Hired Geek
None of the links work (although I guess that coule be 'cos it's not finished ) and there's a missig image to the top right. Its properties give the name as:
PHOTOS%5CFire1.jpg
-
Senior Member
Oh s**t, why doesn't it work in mozilla??
Works fine in IE...
-
Hired Geek
From the source it looks like you've missed the closing </a> tags off your links.
-
Senior Member
Aha! Cheers I shall investigate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|