Matthias, thank you so much for the complete solution. I’m such a beginner with LC server (and not even a beginner at JS) that your explanation was what I needed. -- Scott Morrow
Elementary Software (Now with 20% less chalk dust!) web https://elementarysoftware.com/ email sc...@elementarysoftware.com booth 1-360-734-4701 ------------------------------------------------------ > On Mar 21, 2021, at 4:51 AM, matthias rebbe via use-livecode > <use-livecode@lists.runrev.com> wrote: > > Hi Rick, > here's a sample with some put commands and comments for better understanding. > <?lc > -- read Cookie screeres if available > put $_COOKIE["screenres"] into tScreenRes > > if tScreenRes is empty > then > put "cookie not found. we need to write the cookie<br>" > -- the cookie does not exists or is empty, so we now executing JS, but > -- the following closing tag is mandatory, otherwise the js is not executed > ?> > <script> > let screenwidth = (screen.availWidth); > let screenheight =(screen.availHeight); > document.cookie = "screenres="+screenwidth +","+screenheight; > </script> > <?lc > put "cookie written<br>" > else > put "Cookie already there<br>" > end if > > --now we extract height and width from the var tScreenRes > set the itemdelimiter to "," > put item 1 of tScreenRes to tWidth > put item 2 of tScreenRes to tHeight > > --from here take action according the detected screenresolution. > ?> > > > Note: The above script detects and uses the available screen resolution. > Regards, > > > - > Matthias Rebbe > Life Is Too Short For Boring Code > >> Am 21.03.2021 um 01:02 schrieb Rick Harrison via use-livecode >> <use-livecode@lists.runrev.com>: >> >> Hi Matthias, >> >> So you are thinking something like: >> >> <!DOCTYPE html> >> <html> >> <body> >> >> <h3>Your Screen:</h3> >> >> <div id="demo"></div> >> >> <script> >> var txt = ""; >> txt += "<p>Total width/height: " + screen.width + "*" + screen.height + >> "</p>"; >> txt += "<p>Available width/height: " + screen.availWidth + "*" + >> screen.availHeight + "</p>"; >> txt += "<p>Color depth: " + screen.colorDepth + "</p>"; >> txt += "<p>Color resolution: " + screen.pixelDepth + "</p>"; >> >> document.getElementById("demo").innerHTML = txt; >> </script> >> >> </body> >> </html> >> >> And then put the information into a Javascript cookie and then read the >> cookie value with an LC Server script. >> >> I’ll see if I can get that to work. >> >> Thanks! >> >> Rick >> >>> On Mar 20, 2021, at 6:10 PM, matthias rebbe via use-livecode >>> <use-livecode@lists.runrev.com> wrote: >>> >>> As Livecode Server runs on the server there is no direct command/function >>> in LC Server available for this task. >>> >>> But you could use Javascript (document.cookie) in your LC Server script >>> to write the screen resolution into a cookie and read that cookie then with >>> your Livecode Server script. >>> >>> >>> - >>> Matthias Rebbe >>> Life Is Too Short For Boring Code >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode