Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Is it possible to create session using client side only?

is it possible to create session using client side programming , using JavaScript only? 

user-image
Question ajoutée par Fuad Hasan , Php Web Developer / Software Engineer , Bond Internet Consultancy
Date de publication: 2016/12/26
Leopoldo Falcon
par Leopoldo Falcon , It Service Desk Support , Interdominios

Yes, the browser can store variables, even with jquery

Rolando Toledo Jr
par Rolando Toledo Jr , Web Developer , IDESS Interactive Technologies Inc.

Technologies are now evolving, actually you can save a session for client side using 

HTML Local Storage Objects
  • window.localStorage - stores data with no expiration date
  • window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)

also you can save a session in Cookies by using javascript

No, but you can make an AJAX request to PHP to set one.

Goncalo Lourenco
par Goncalo Lourenco , Full Stack Developer & IPTV Engineer , NOS

No, but you can make an AJAX request to PHP to set one.

For example:

Javascript file:

var xmlhttp =newXMLHttpRequest(); xmlhttp.open("GET","session_maker.php",true); xmlhttp.onreadystatechange =function(){if(xmlhttp.readyState ==4&& xmlhttp.status ==200){ alert("Done! Session created.");}};

PHP File:

 

<?php session_start(); $_SESSION['mySession']=1;?>

 

More Questions Like This