Hey guys! I have a problem, and hope you can help me!
Is there any way to determine wich resolution the viewer is using, and depending on it, to load differrent html files? For example if it is 1024 to load index.html, and if it is 1280 to load index2.html?
@NyfaelSep 21.2006 — #You should make your page dynamic enough to do it on it's own.. you can use styles, etc. etc., but if you really want to, there is a way.
PHP is serverside, meaning it does stuff on the server. If I'm correct, the only way to get the resolution is to use javascript:
window.screen.width
window.screen.height
But since you can't dynamically include a page based on javascript, you would have to make it go to one page, grab the variables, load another page, and then that page could dynamically include a file.
As I said, just making your website support multiple widths is better.
And if you don't know how to grab php variables, one way is to put php on the page looking for a form request. If it's not there, then it sticks in the javascript code in a form value, and submits the form to itself. The page then reloads, the php sees that the form has submitted, and now you have the screen width and height in php, and can do whatever you want.
A sort of reverse AJAX could be useful, though I have no idea how to do that.
@felgallSep 21.2006 — #The available space in the browser is less than the screen resolution (much less if the browser is not open full screen). About the only things you can rely on are that people using web readers don't have a resolution, those using webTV have a fixed width of 544 pixels, those using handheld devices are unlikely to have resolutions above 300 pixels, and those using large screen resolutions are less likely to open their browser full screen.