Question: I would like to save the height of the window's portview (browser) in a session variable. Is that possible and how is it done?

var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();

Answer: 
In a PHP session variable? You could make an AJAX call to a PHP script that would store the incoming variable in the PHP session.

Javascript

```
var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
jQuery.post('URL_TO_PHP_SCRIPT_HERE', {height: viewportHeight});

```

PHP

```
$_SESSION['viewportHeight'] = $_POST['height'];

```

Be sure to sanitize the incoming $\_POST data. Maybe use `intval()` on `$_POST['height']`.
Here are some suggestions:

* Pass your variable in query string
* Pass it via hidden field
* Use **cookies** instead.
* Pass your variable via ajax and store in php session