0

I want to get the width of the screen without the user pressing a button etc.

I first found the following question

Screen width stackoverflow question

So i tried that and my code is shown below

Screen shot of code

As you can see it doesnt like screen so I am not sure what I am doing wrong here.

I then looked into using Javascript but not sure how to trigger it without an event. I have the following so far.

    <script>
    var screenWidth = screen.width;
    var screenHeight = screen.height;
    document.getElementById("<%=HiddenField1.UniqueID%>").innerText = screenWidth;
</script>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HiddenField2" runat="server" />

When i query this in my vb I just get an empty string.

Can anyone help?

Silentbob
  • 2,805
  • 7
  • 38
  • 70

0 Answers0