ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Fuad Hasan , Php Web Developer / Software Engineer , Bond Internet Consultancy
تاريخ النشر: 2016/12/26
Leopoldo Falcon
من قبل Leopoldo Falcon , It Service Desk Support , Interdominios

Yes, the browser can store variables, even with jquery

Rolando Toledo Jr
من قبل 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

Irfan Niaz
من قبل Irfan Niaz

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

Goncalo Lourenco
من قبل 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;?>

 

المزيد من الأسئلة المماثلة