recognize screen resolution
Is there a possibility to recognignize the users'screen resolution and then let your website respond to it by loading the right images/using the right layout?
Can it be done with javascript or does it need for example a java applet or activeX-control?
thx
Lloyd Hassell posted this at 14:44 — 29th February 2000.
They have: 231 posts
Joined: Feb 2000
You can grab the clients resolution using the following code:
var screenWidth = screen.width;
var screenHeight = screen.height;
If you want to display a different set of images per resolution you can either link to a new page or dynamically write the content.
// 640x480
if (screen.width == 640 && screen.height == 480) {
window.location.href = "url_640480.html";
}
Repeat the if statement above for all possible screen combinations.
------------------
Lloyd Hassell
[email protected]
http://go.to/hass
:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::
JP Stones posted this at 12:06 — 8th March 2000.
They have: 2,390 posts
Joined: Nov 1998
what if they have resized their window to a smaller size?
JP
------------------
What Next?
"Easing you onto the Internet"
http://www.what-next.com
Lloyd Hassell posted this at 13:49 — 8th March 2000.
They have: 231 posts
Joined: Feb 2000
If the user resizes their browser window you can add a piece of code that will reload the document and assess the dimensions again.
Add b/w <head></head> tags:
window.onresize = new Function("window.location.reload()");
:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.