Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

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 added by Fuad Hasan , Php Web Developer / Software Engineer , Bond Internet Consultancy
Date Posted: 2016/12/26
Leopoldo Falcon
by Leopoldo Falcon , It Service Desk Support , Interdominios

Yes, the browser can store variables, even with jquery

Rolando Toledo Jr
by 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
by 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

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.