I don't know if this is even possible, but I'd appreciate any help.
$request
?I know that I can get the DOM width with jQuery $(document).width()
, but I need the width value on server side; before any js is executed.
@ArturGrigio You can try set JavaScript cookie and access it in Laravel
. When user visits your website, get the screen size with JS (window.width
) and store it in a cookie screen=WxH
In Laravel $screen = Cookie::get('screen');
$screen = explode("x", $screen);
$width = $screen[0]
$height = $screen[0];
This is 1 solution to do it.
Unfortunately the is no way to get screen size info from PHP. You can try to play around with User Agent and detect if it is a mobile or desktop or tablet. and make fix sizes for those 3 types.