Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Determine screen resolution or browser viewport size


frimipiso

Recommended Posts

Hi,

 

I would like to adapt the sizes of the product images and the number

of columns to the viewport size of the browser (or the screen resolution of

the potential customer).

 

Do you know of any way to find this out? I have only seen some java

applet that tries to get this information. But I would also like to get it

if java is disabled.

 

Thanks for your help,

 

Jens

Link to comment
Share on other sites

Hi,

 

I would like to adapt the sizes of the product images and the number

of columns to the viewport size of the browser (or the screen resolution of

the potential customer).

 

Do you know of any way to find this out? I have only seen some java

applet that tries to get this information. But I would also like to get it

if java is disabled.

 

Thanks for your help,

 

Jens

The only way that you can do this is by grabbing their resolution with javascript... None of that data is passed in the standard info between the client and the server, but javascript can pull that data from the client side... Also, since javascript doesn't execute until the page has loaded, you can't size the images to the window first, but you could *re*size them I suppose... The only way that you could work with this value server side in order to size all of that stuff during the processing phase, would be if on the initial page load, you pulled that resolution value and stored it in a cookie (I don't know if javascript can manipulate session data directly, I would imagine it can, but I know it can manipulate cookies :D)... Then on subsequent page requests, you could pull that data from the cookie (or session data) and use that to make all of your calculations... However, it would require javascript to be enabled in the browser, to even grab that initial value...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...