NetTalk Central

Author Topic: Screen display size  (Read 3010 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Email
Screen display size
« on: May 10, 2011, 02:15:15 AM »
Hi,
How can I get the screen display size ( full screen size available) from the browser that is using my Net Talk web server program.  If I can get the full height and width of the screen that the browser is running in,then I can scale my browse fields appropriately.....( excludes mobile devices....).
Thanks,
Ron Jolda

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Screen display size
« Reply #1 on: May 10, 2011, 05:01:11 AM »
Hi Ron,

You can probably scale your browse columns with the CSS percent technique. Thats how i'd do it. However, if you really want to know the browser window width there is a way to do it. I'd recommend not doing it. I think there are better ways. But for the technical exercise here goes:

1. Most of us use memory forms on top of our browsers, if so, add a new field (call it BrowseWidth), make it a local variable which is a LONG (or similar). Check send new value to server. Edit that embed point. This is the embed point  that will run to give you the browser width (it will be in this field). Add 1=1 into the hide field so you cannot see it.

2. Go into XHTML for the procedure and add a routine, give it a name, set to after </form> and embed this code into it.

<script>
$.get('/MEMORYFORMNAME_browsewidth_value?event=1&value='+window.innerWidth);
</script>

MEMORYFORMNAME should be the name of your memory form.

After the browse loads an ajax call will fire sending the browser width via NetTalk ajax system into your variable created in step 1.

I tested it and it works. Some versions of IE and other browsers may need a slightly different syntax for document.innerWidth.

If they resize their browser window it wont re-send the new width, it could, but again, i dont really think this is the right approach.

Regards
Bill