I have checked windows width in php and store it in variable. While putting the variable under the if condition, it is always showing me false. I did var_dump and i can see the entire script to be printed.
$window_width = "<script type='text/javascript'>document.write(window.innerWidth);</script>";
This is in the controller, which i pass to the view.
var_dump($pageWidth);
//ctrl+u is showing this
//string(74) "<script type='text/javascript'>document.write(window.innerWidth);
//Html is rendering, so it is showing string(74) "768"