Htusa Adssad
Htusa Adssad

Reputation: 105

Getting the width of the user's screen

I realized this is only possible from the client's side, but I still need to use the width on the server side. So, to get the width, I used screen.width in javascript. I tried to get it on the server side and display it so I wrote response.write(<script>return screen.width;</script>);. Is there a reason screen.width keeps returning null in c# even though it returns 1280 in javascript? Edit: I also tried to pass the value from js to c# using hiddenfields, but it keeps sending the value as null even though its 1280 in js.

Upvotes: 2

Views: 142

Answers (1)

Alexander Fresh
Alexander Fresh

Reputation: 92

screen.width is not equal to the width of the user's browser. The width property returns the total width of the visitor's screen.

Upvotes: 1

Related Questions