Question

I have an ASP.Net ImageButton in .Net 3.5. It's a large image, 450x700 that users can click on. On the server side, the OnClick event handler does some stuff based on the coordinates that the user clicks.

It's a basic map, just a single static image, that users can click on.

It works great, except when, in IE, the user is at a zoom level other than 100%. In that case, it passes the actual pixel coordinates of the click, meaning that I get a point that's somewhere on a line between the origin and the point of the click.

I looked at doing something like actualX = clickedX * image.Width / 450, but the image size properties don't change when the image is zoomed, image.Width always stays at 450.

Short of a bunch of Javascript black magic that I'd rather avoid is there any way to find the original image coordinates that correspond to the point that is clicked?

Was it helpful?

Solution

It is not possible for the server to determine the zoom level of the browser without Javascript.

This sounds like a bug in IE. Zooming in on the page should be completely transparent to the server. You should report this to Microsoft.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top