Automatic Web Page Resolution - TechRepublic
General discussion
February 11, 2002 at 06:11 AM
stevenlschneider

Automatic Web Page Resolution

by stevenlschneider . Updated 24 years, 5 months ago

I recieved a webmaster tip via email that said you could auto detect and adjust for a person logging onto your web site. It said you had to create a directory and pages for each resolution and have your site detect the resolution of the viewer and you can automatically swith them to the correct directory for viewing. I’ve tried and can’t get the my site to switch. Any help would be appreciated. It says it can be accomplished by using a simple function in the HEAD of the code. The sample page given auto switches bu I can’t get the code of the original page to compair. Here is the code:
function newResolution() {
var url640 = “/640/index.html”;
var url800 = “/800/index.html”;
var url1024 = “/1024/index.html”;
if ((screen.width = = 640) && (screen.height == 480))
window.location.href= url640;
else if ((screen.width == 800) && (screen.height = = 600))
window.location.href= url800;
else if ((screen.width = = 1024) && (screen.height = = 768))
window.location.href= url1024;
else windo.locatio.href= url800;
}
Next, simply use onload in the BODY tag to run the function:

The sample page is: http://tips.internet.directnic.com/resolution.html
any help would be appreciated. Thanks.
Can you get it to work? The

This discussion is locked

All Comments