Can I get data from localstorage using php

Issue

Can I get data from localstorage using php if yes then tell me how
in localstorage data set like this

<script>
var i=0;
function inc()
{
    i+=1;
    localStorage.setItem("qnum", i);
}
</script>

Solution

No, you can’t. PHP runs on your server, the localStorage is only available in the browser of the client.

The only way is to read the localStorage via JavaScript, and send the result to your server via ajax.

Answered By – Markus Kollers

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published