Hi Matthias,

Thanks!

Rick

> On Mar 21, 2021, at 7: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
> 


_______________________________________________
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

Reply via email to